adding wg-gesucht as provider

This commit is contained in:
Christian Kellner
2019-06-10 14:40:28 +02:00
parent f429221b2e
commit 9961706523
5 changed files with 87 additions and 4 deletions

41
test/wgGesucht.test.js Normal file
View File

@@ -0,0 +1,41 @@
const mockNotification = require('./mocks/mockNotification');
const mockConfig = require('../conf/config.test');
const mockStore = require('./mocks/mockStore');
const mockStats = require('./mocks/mockStats');
const proxyquire = require('proxyquire').noCallThru();
const expect = require('chai').expect;
describe.only('#wgGesucht testsuite()', () => {
const wgGesucht = proxyquire('../lib/provider/wgGesucht', {
'../../conf/config.json': mockConfig,
'../lib/fredy': proxyquire('../lib/fredy', {
'./services/store': mockStore,
'./notification/notify': mockNotification
})
});
it.only('should test wgGesucht provider', async () => {
return await new Promise(resolve => {
wgGesucht.run(mockStats).then(() => {
const wgGesuchtDbContent = wgGesucht._getStore()._db;
expect(wgGesuchtDbContent.wgGesucht).to.be.a('array');
const notificationObj = mockNotification.get();
expect(notificationObj.serviceName).to.equal('wgGesucht');
notificationObj.payload.forEach((notify, idx) => {
expect(notify).to.be.a('object');
/** check the actual structure **/
expect(notify.id).to.be.a('string');
expect(notify.title).to.be.a('string');
expect(notify.details).to.be.a('string');
expect(notify.description).to.be.a('string');
expect(notify.link).to.be.a('string');
});
resolve();
});
});
});
});