diff --git a/lib/helpers.ts b/lib/helpers.ts index b0b55c7..ca107e6 100644 --- a/lib/helpers.ts +++ b/lib/helpers.ts @@ -142,6 +142,8 @@ export function verifyDate(dateString: string) { export function verifyByName(activityDates: ActivityDates[], className: string, description: string, date: Date, icon?: string, color?: string): void { var foundType: boolean = false; + console.log(`Description: ${description}, Classname: ${className}.`); + if (!description || description === '' || typeof description === undefined) { if (className == 'dhm') { foundType = true; @@ -156,14 +158,19 @@ export function verifyByName(activityDates: ActivityDates[], className: string, const localDescription = description; // Keep original description description = description.toLowerCase(); // Convert description to lowercase for comparison - if (description.indexOf('groente') !== -1 || description.indexOf('gft') !== -1 || description.indexOf('bio') !== -1 || description.indexOf('green') !== -1) { + if ( + description.indexOf('etensresten') !== -1 || + description.indexOf('groente') !== -1 || + description.indexOf('gft') !== -1 || + description.indexOf('bio') !== -1 || + description.indexOf('green') !== -1 + ) { addDate(activityDates, TrashType.GFT, date, icon, localDescription, color); foundType = true; } if ( - description.indexOf('rest') !== -1 || - description.indexOf('etensresten') !== -1 || + (description.indexOf('rest') !== -1 && description.indexOf('etensresten') === -1) || description.indexOf('residual') !== -1 || description.indexOf('grey') !== -1 || description.indexOf('sortibak') !== -1 || diff --git a/lib/trashapis.ts b/lib/trashapis.ts index 40c3c21..4a6982b 100644 --- a/lib/trashapis.ts +++ b/lib/trashapis.ts @@ -407,7 +407,6 @@ export class TrashApis { searchResultIndex = nextResult > 0 ? searchResultIndex + 4 + nextResult : -1; } - this.#log('Anddddd exit'); return fDates; } diff --git a/test/trashApiTests.ts b/test/trashApiTests.ts index 3af4d35..8039154 100644 --- a/test/trashApiTests.ts +++ b/test/trashApiTests.ts @@ -285,10 +285,10 @@ describe('TrashApiRad', function () { const isValid = validateApiResults(apiSettings, result); assert.equal(isValid, true); }); -});*/ +}); describe('TrashApiRecbe', function () { - /*it('API - Afvalkalender Recycle BE - 1', async function () { + it('API - Afvalkalender Recycle BE - 1', async function () { const apiSettings: ApiSettings = { zipcode: '8930', housenumber: '58', @@ -346,7 +346,7 @@ describe('TrashApiRecbe', function () { const result = await testAPI(apiSettings); const isValid = validateApiResults(apiSettings, result); assert.equal(isValid, true); - });*/ + }); it('API - RECYCLE BE 5', async function () { const apiSettings: ApiSettings = { @@ -363,7 +363,7 @@ describe('TrashApiRecbe', function () { assert.equal(isValid, true); }); }); -/* + describe('TrashApiAvr', function () { it('API - Afvalkalender AVRI', async function () { const apiSettings: ApiSettings = { @@ -412,8 +412,25 @@ describe('TrashApiRd4', function () { assert.equal(isValid, true); }); }); - +*/ describe('TrashApiAfw', function () { + it('API - Mijn Afvalwijzer (7) - Rotterdam', async function () { + const apiSettings: ApiSettings = { + zipcode: '3077SJ', + housenumber: '9', + country: 'NL', + apiId: 'afw', + cleanApiId: '', + streetname: '', + }; + + const result = await testAPI(apiSettings); + const isValid = validateApiResults(apiSettings, result); + assert.equal(isValid, true); + }); +}); +/* + it('API - Mijn Afvalwijzer (1)', async function () { const apiSettings: ApiSettings = { zipcode: '9821TT',