2025-12-11 10:40:55 +01:00
|
|
|
/*
|
2026-01-12 15:00:36 +01:00
|
|
|
* Copyright (c) 2026 by Christian Kellner.
|
2025-12-11 10:40:55 +01:00
|
|
|
* Licensed under Apache-2.0 with Commons Clause and Attribution/Naming Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2023-03-13 13:42:43 +01:00
|
|
|
import * as similarityCache from '../../lib/services/similarity-check/similarityCache.js';
|
|
|
|
|
import { get } from '../mocks/mockNotification.js';
|
|
|
|
|
import { mockFredy, providerConfig } from '../utils.js';
|
2026-03-16 14:26:58 +01:00
|
|
|
import { expect } from 'vitest';
|
2023-03-13 13:42:43 +01:00
|
|
|
import * as provider from '../../lib/provider/wgGesucht.js';
|
2024-01-01 16:14:25 +01:00
|
|
|
|
2020-02-26 09:05:20 +01:00
|
|
|
describe('#wgGesucht testsuite()', () => {
|
2021-01-21 16:09:23 +01:00
|
|
|
provider.init(providerConfig.wgGesucht, [], []);
|
2020-02-26 09:05:20 +01:00
|
|
|
it('should test wgGesucht provider', async () => {
|
2023-03-13 13:42:43 +01:00
|
|
|
const Fredy = await mockFredy();
|
2021-01-21 16:09:23 +01:00
|
|
|
return await new Promise((resolve) => {
|
2026-03-08 09:44:18 +01:00
|
|
|
const fredy = new Fredy(provider.config, null, null, provider.metaInformation.id, 'wgGesucht', similarityCache);
|
2021-01-21 16:09:23 +01:00
|
|
|
fredy.execute().then((listing) => {
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(listing).toBeInstanceOf(Array);
|
2023-03-13 13:42:43 +01:00
|
|
|
const notificationObj = get();
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(notificationObj.serviceName).toBe('wgGesucht');
|
2021-01-21 16:09:23 +01:00
|
|
|
notificationObj.payload.forEach((notify) => {
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(notify).toBeTypeOf('object');
|
2020-02-26 09:05:20 +01:00
|
|
|
/** check the actual structure **/
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(notify.id).toBeTypeOf('string');
|
|
|
|
|
expect(notify.title).toBeTypeOf('string');
|
|
|
|
|
expect(notify.details).toBeTypeOf('string');
|
|
|
|
|
expect(notify.price).toBeTypeOf('string');
|
|
|
|
|
expect(notify.link).toBeTypeOf('string');
|
2020-02-26 09:05:20 +01:00
|
|
|
});
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|