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
|
|
|
|
|
*/
|
|
|
|
|
|
2026-03-16 14:26:58 +01:00
|
|
|
import { expect } from 'vitest';
|
2023-03-13 13:42:43 +01:00
|
|
|
import * as similarityCache from '../../lib/services/similarity-check/similarityCache.js';
|
2025-05-09 09:26:24 +02:00
|
|
|
import { mockFredy, providerConfig } from '../utils.js';
|
|
|
|
|
import { get } from '../mocks/mockNotification.js';
|
2023-03-13 13:42:43 +01:00
|
|
|
import * as provider from '../../lib/provider/immoscout.js';
|
2024-01-01 16:14:25 +01:00
|
|
|
|
2025-05-09 09:26:24 +02:00
|
|
|
describe('#immoscout provider testsuite()', () => {
|
|
|
|
|
provider.init(providerConfig.immoscout, [], []);
|
|
|
|
|
it('should test immoscout provider', async () => {
|
|
|
|
|
const Fredy = await mockFredy();
|
|
|
|
|
return await new Promise((resolve) => {
|
2026-03-08 09:44:18 +01:00
|
|
|
const fredy = new Fredy(provider.config, null, null, provider.metaInformation.id, '', similarityCache);
|
2025-05-09 09:26:24 +02:00
|
|
|
fredy.execute().then((listings) => {
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(listings).toBeInstanceOf(Array);
|
2025-05-09 09:26:24 +02:00
|
|
|
const notificationObj = get();
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(notificationObj).toBeTypeOf('object');
|
|
|
|
|
expect(notificationObj.serviceName).toBe('immoscout');
|
2025-05-09 09:26:24 +02:00
|
|
|
notificationObj.payload.forEach((notify) => {
|
|
|
|
|
/** check the actual structure **/
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(notify.id).toBeTypeOf('string');
|
|
|
|
|
expect(notify.price).toBeTypeOf('string');
|
|
|
|
|
expect(notify.size).toBeTypeOf('string');
|
|
|
|
|
expect(notify.title).toBeTypeOf('string');
|
|
|
|
|
expect(notify.link).toBeTypeOf('string');
|
|
|
|
|
expect(notify.address).toBeTypeOf('string');
|
2025-05-09 09:26:24 +02:00
|
|
|
/** check the values if possible **/
|
2026-03-16 14:26:58 +01:00
|
|
|
expect(notify.size).not.toBe('');
|
|
|
|
|
expect(notify.title).not.toBe('');
|
|
|
|
|
expect(notify.link).toContain('https://www.immobilienscout24.de/');
|
2021-05-11 11:25:14 +02:00
|
|
|
});
|
2025-05-09 09:26:24 +02:00
|
|
|
resolve();
|
|
|
|
|
});
|
2021-05-11 11:25:14 +02:00
|
|
|
});
|
2025-05-09 09:26:24 +02:00
|
|
|
});
|
|
|
|
|
});
|