diff --git a/lib/provider/immonet.js b/lib/provider/immonet.js index 2499e56..c775ca0 100755 --- a/lib/provider/immonet.js +++ b/lib/provider/immonet.js @@ -29,6 +29,7 @@ const config = { address: 'div[data-testid="cardmfe-description-box-address"] | trim', image: 'div[data-testid="cardmfe-picture-box-test-id"] img@src', link: 'button@data-base', + description: 'div[data-testid="cardmfe-description-text-test-id"] | trim', }, normalize: normalize, filter: applyBlacklist, diff --git a/lib/provider/immowelt.js b/lib/provider/immowelt.js index 924936e..027b5a6 100755 --- a/lib/provider/immowelt.js +++ b/lib/provider/immowelt.js @@ -26,8 +26,9 @@ const config = { size: 'div[data-testid="cardmfe-keyfacts-testid"] | removeNewline | trim', title: 'div[data-testid="cardmfe-description-box-text-test-id"] > div:nth-of-type(2)', link: 'a@href', + description: 'div[data-testid="cardmfe-description-text-test-id"] > div:nth-of-type(2) | removeNewline | trim', address: 'div[data-testid="cardmfe-description-box-address"] | removeNewline | trim', - image: 'div[data-testid="cardMfe-card-pictureBox-opacity"] img@src', + image: 'div[data-testid="cardmfe-picture-box-opacity-layer-test-id"] img@src', }, normalize: normalize, filter: applyBlacklist, diff --git a/test/provider/immonet.test.js b/test/provider/immonet.test.js index e21c8a7..b730c56 100644 --- a/test/provider/immonet.test.js +++ b/test/provider/immonet.test.js @@ -8,31 +8,30 @@ describe('#immonet testsuite()', () => { after(() => { similarityCache.stopCacheCleanup(); }); - provider.init(providerConfig.immonet, [], []); + it('should test immonet provider', async () => { const Fredy = await mockFredy(); - return await new Promise((resolve) => { - const fredy = new Fredy(provider.config, null, provider.metaInformation.id, 'immonet', similarityCache); - fredy.execute().then((listing) => { - expect(listing).to.be.a('array'); - const notificationObj = get(); - expect(notificationObj).to.be.a('object'); - expect(notificationObj.serviceName).to.equal('immonet'); - notificationObj.payload.forEach((notify) => { - /** check the actual structure **/ - expect(notify.id).to.be.a('string'); - 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'); - expect(notify.address).to.be.a('string'); + provider.init(providerConfig.immonet, [], []); - expect(notify.size).that.does.include('m²'); - expect(notify.title).to.be.not.empty; - expect(notify.address).to.be.not.empty; - }); - resolve(); - }); + const fredy = new Fredy(provider.config, null, provider.metaInformation.id, 'immonet', similarityCache); + const listing = await fredy.execute(); + + expect(listing).to.be.a('array'); + const notificationObj = get(); + expect(notificationObj).to.be.a('object'); + expect(notificationObj.serviceName).to.equal('immonet'); + notificationObj.payload.forEach((notify) => { + /** check the actual structure **/ + expect(notify.id).to.be.a('string'); + 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'); + expect(notify.address).to.be.a('string'); + /** check the values if possible **/ + expect(notify.size).that.does.include('m²'); + expect(notify.title).to.be.not.empty; + expect(notify.address).to.be.not.empty; }); }); }); diff --git a/test/provider/immowelt.test.js b/test/provider/immowelt.test.js index 3d3e53c..fb81f24 100644 --- a/test/provider/immowelt.test.js +++ b/test/provider/immowelt.test.js @@ -8,33 +8,32 @@ describe('#immowelt testsuite()', () => { after(() => { similarityCache.stopCacheCleanup(); }); + it('should test immowelt provider', async () => { const Fredy = await mockFredy(); provider.init(providerConfig.immowelt, [], []); - return await new Promise((resolve) => { - const fredy = new Fredy(provider.config, null, provider.metaInformation.id, 'immowelt', similarityCache); - fredy.execute().then((listing) => { - expect(listing).to.be.a('array'); - const notificationObj = get(); - expect(notificationObj).to.be.a('object'); - expect(notificationObj.serviceName).to.equal('immowelt'); - notificationObj.payload.forEach((notify) => { - /** check the actual structure **/ - expect(notify.id).to.be.a('string'); - expect(notify.price).to.be.a('string'); - expect(notify.title).to.be.a('string'); - expect(notify.link).to.be.a('string'); - expect(notify.address).to.be.a('string'); - /** check the values if possible **/ - if (notify.size != null && notify.size.trim().toLowerCase() !== 'k.a.') { - expect(notify.size).that.does.include('m²'); - } - expect(notify.title).to.be.not.empty; - expect(notify.link).that.does.include('https://www.immowelt.de'); - expect(notify.address).to.be.not.empty; - }); - resolve(); - }); + + const fredy = new Fredy(provider.config, null, provider.metaInformation.id, 'immowelt', similarityCache); + const listing = await fredy.execute(); + + expect(listing).to.be.a('array'); + const notificationObj = get(); + expect(notificationObj).to.be.a('object'); + expect(notificationObj.serviceName).to.equal('immowelt'); + notificationObj.payload.forEach((notify) => { + /** check the actual structure **/ + expect(notify.id).to.be.a('string'); + expect(notify.price).to.be.a('string'); + expect(notify.title).to.be.a('string'); + expect(notify.link).to.be.a('string'); + expect(notify.address).to.be.a('string'); + /** check the values if possible **/ + if (notify.size != null && notify.size.trim().toLowerCase() !== 'k.a.') { + expect(notify.size).that.does.include('m²'); + } + expect(notify.title).to.be.not.empty; + expect(notify.link).that.does.include('https://www.immowelt.de'); + expect(notify.address).to.be.not.empty; }); }); });