Skip to content

Commit

Permalink
Fixed typings mijnafvalwijzer #230
Browse files Browse the repository at this point in the history
  • Loading branch information
robertraaijmakers committed Feb 25, 2025
1 parent 27019d0 commit 3e7736b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
13 changes: 10 additions & 3 deletions lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 ||
Expand Down
1 change: 0 additions & 1 deletion lib/trashapis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ export class TrashApis {
searchResultIndex = nextResult > 0 ? searchResultIndex + 4 + nextResult : -1;
}

this.#log('Anddddd exit');
return fDates;
}

Expand Down
27 changes: 22 additions & 5 deletions test/trashApiTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 = {
Expand All @@ -363,7 +363,7 @@ describe('TrashApiRecbe', function () {
assert.equal(isValid, true);
});
});
/*
describe('TrashApiAvr', function () {
it('API - Afvalkalender AVRI', async function () {
const apiSettings: ApiSettings = {
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 3e7736b

Please sign in to comment.