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 { providerConfig, mockFredy } from '../utils.js';
|
2024-01-01 16:14:25 +01:00
|
|
|
import { expect } from 'chai';
|
2023-03-13 13:42:43 +01:00
|
|
|
import * as provider from '../../lib/provider/einsAImmobilien.js';
|
|
|
|
|
|
2020-02-26 09:05:20 +01:00
|
|
|
describe('#einsAImmobilien testsuite()', () => {
|
2021-01-21 16:09:23 +01:00
|
|
|
provider.init(providerConfig.einsAImmobilien, [], []);
|
2020-02-26 09:05:20 +01:00
|
|
|
it('should test einsAImmobilien 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) => {
|
2022-12-11 20:07:18 +01:00
|
|
|
const fredy = new Fredy(provider.config, null, provider.metaInformation.id, 'einsAImmobilien', similarityCache);
|
2021-01-21 16:09:23 +01:00
|
|
|
fredy.execute().then((listings) => {
|
|
|
|
|
expect(listings).to.be.a('array');
|
2023-03-13 13:42:43 +01:00
|
|
|
const notificationObj = get();
|
2020-02-26 09:05:20 +01:00
|
|
|
expect(notificationObj).to.be.a('object');
|
|
|
|
|
expect(notificationObj.serviceName).to.equal('einsAImmobilien');
|
2021-01-21 16:09:23 +01:00
|
|
|
notificationObj.payload.forEach((notify) => {
|
2020-02-26 09:05:20 +01:00
|
|
|
/** check the actual structure **/
|
2024-09-05 13:34:14 +02:00
|
|
|
expect(notify.id).to.be.a('string');
|
2020-02-26 09:05:20 +01:00
|
|
|
expect(notify.price).to.be.a('string');
|
|
|
|
|
expect(notify.size).to.be.a('string');
|
|
|
|
|
expect(notify.title).to.be.a('string');
|
|
|
|
|
expect(notify.link).to.be.a('string');
|
2025-09-18 15:38:23 +02:00
|
|
|
expect(notify.address).to.be.a('string');
|
2020-02-26 09:05:20 +01:00
|
|
|
/** check the values if possible **/
|
|
|
|
|
expect(notify.size).to.be.not.empty;
|
|
|
|
|
expect(notify.title).to.be.not.empty;
|
|
|
|
|
expect(notify.link).that.does.include('https://www.1a-immobilienmarkt.de');
|
|
|
|
|
});
|
|
|
|
|
resolve();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
});
|