mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
adding wg-gesucht as provider
This commit is contained in:
41
test/wgGesucht.test.js
Normal file
41
test/wgGesucht.test.js
Normal 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();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user