You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
End-to-end testing fails after PR #307 if using MongoDB as the database provider. This happens because the new parent property (#307) that includes areas data (either Province, Regency, or District) contains id property which is brought from MongoDB.
Before this, the id property was removed automatically by the transformer TransformInterceptor (see the implementations in PR #179, #185, and #187).
To Reproduce
Steps to reproduce the behavior:
Just follow the installation guide and choose MongoDB as the database provider
Run npm run test:e2e
Expected behavior
End-to-end testing successful without any errors.
Screenshots or Error logs
> [email protected] test:e2e
> vitest run --config ./vitest.config.e2e.ts
RUN v0.34.6 .../idn-area
❯ test/district.e2e-spec.ts (9 tests | 1 failed) 5137ms
❯ test/district.e2e-spec.ts > District (e2e) > GET /districts/{code} > should return the district with the `code`
→ expected { Object (code, name, ...) } to deeply equal { code: '327325', …(3) }
❯ test/island.e2e-spec.ts (10 tests | 1 failed) 5747ms
❯ test/island.e2e-spec.ts > Island (e2e) > GET /islands/{code} > should return the island with the `code`
→ expected { code: '110140001', …(8) } to deeply equal { code: '110140001', …(8) }
❯ test/village.e2e-spec.ts (9 tests | 1 failed) 6684ms
❯ test/village.e2e-spec.ts > Village (e2e) > GET /villages/{code} > should return the village data if the `code` exists
→ expected { code: '3204052004', …(3) } to deeply equal { code: '3204052004', …(3) }
✓ test/app.e2e-spec.ts (1 test) 72ms
✓ test/regency.e2e-spec.ts (8 tests) 4188ms
✓ test/province.e2e-spec.ts (8 tests) 3924ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 3 ⎯⎯⎯⎯⎯⎯⎯
FAIL test/district.e2e-spec.ts > District (e2e) > GET /districts/{code} > should return the district with the `code`
AssertionError: expected { Object (code, name, ...) } to deeply equal { code: '327325', …(3) }
- Expected
+ Received
Object {
"code": "327325",
"name": StringMatching /^[a-zA-Z0-9\-'.\\/() ]+$/,
"parent": Object {
"province": Object {
"code": "32",
+ "id": "65dbcf93f3d15088058db400",
"name": StringMatching /^(?!\s)(?!PROVINSI)[A-Z ]+$/,
},
"regency": Object {
"code": "3273",
+ "id": "65dbcf94f3d15088058db4cf",
"name": StringMatching /^(?:KABUPATEN|KOTA)[A-Z ]+$/,
"provinceCode": "32",
},
},
"regencyCode": "3273",
}
❯ test/district.e2e-spec.ts:108:24
106| );
107|
108| expect(district).toEqual({
| ^
109| code: testCode,
110| name: expect.stringMatching(districtRegex.name),
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/3]⎯
FAIL test/island.e2e-spec.ts > Island (e2e) > GET /islands/{code} > should return the island with the `code`
AssertionError: expected { code: '110140001', …(8) } to deeply equal { code: '110140001', …(8) }
- Expected
+ Received
Object {
"code": "110140001",
"coordinate": StringMatching /^([0-8][0-9]|90)°([0-5][0-9]|60)'(([0-5][0-9].[0-9]{2})|60.00)"\s(N|S)\s(0\d{2}|1([0-7][0-9]|80))°([0-5][0-9]|60)'(([0-5][0-9].[0-9]{2})|60.00)"\s(E|W)$/,
"isOutermostSmall": Any<Boolean>,
"isPopulated": Any<Boolean>,
"latitude": Any<Number>,
"longitude": Any<Number>,
"name": StringMatching /^[a-zA-Z0-9\-'/ ]+$/,
"parent": Object {
"province": Object {
"code": "11",
+ "id": "65dbcf93f3d15088058db3f5",
"name": StringMatching /^[a-zA-Z0-9\-'/ ]+$/,
},
"regency": Object {
"code": "1101",
+ "id": "65dbcf94f3d15088058db41b",
"name": StringMatching /^(?:KABUPATEN|KOTA)[A-Z ]+$/,
"provinceCode": "11",
},
},
"regencyCode": "1101",
}
❯ test/island.e2e-spec.ts:136:22
134| const island = await tester.expectData<Island>(`${baseUrl}/${tes…
135|
136| expect(island).toEqual({
| ^
137| code: testCode,
138| coordinate: expect.stringMatching(islandRegex.coordinate),
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/3]⎯
FAIL test/village.e2e-spec.ts > Village (e2e) > GET /villages/{code} > should return the village data if the `code` exists
AssertionError: expected { code: '3204052004', …(3) } to deeply equal { code: '3204052004', …(3) }
- Expected
+ Received
Object {
"code": "3204052004",
"districtCode": "320405",
"name": StringMatching /^[a-zA-Z0-9\-'"’.*\\/() ]+$/,
"parent": Object {
"district": Object {
"code": "320405",
+ "id": "65dbcf96f3d15088058dbe6e",
"name": StringMatching /^[a-zA-Z0-9\-'.\\/() ]+$/,
"regencyCode": "3204",
},
"province": Object {
"code": "32",
+ "id": "65dbcf93f3d15088058db400",
"name": StringMatching /^(?!\s)(?!PROVINSI)[A-Z ]+$/,
},
"regency": Object {
"code": "3204",
+ "id": "65dbcf94f3d15088058db4be",
"name": StringMatching /^(?:KABUPATEN|KOTA)[A-Z ]+$/,
"provinceCode": "32",
},
},
}
❯ test/village.e2e-spec.ts:109:23
107| );
108|
109| expect(village).toEqual({
| ^
110| code: testCode,
111| name: expect.stringMatching(villageRegex.name),
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/3]⎯
Test Files 3 failed | 3 passed (6)
Tests 3 failed | 42 passed (45)
Start at 07:25:07
Duration 11.88s (transform 103ms, setup 0ms, collect 4.96s, tests 25.75s, environment 1ms, prepare 477ms)
Suggestion
It gets more complicated if we have to delete the id property from all area data in parent property. Therefore, it will be better if we bring back the generated MongoDB id to the response. We just need to explain this MongoDB behavior in the documentation.
The text was updated successfully, but these errors were encountered:
Describe the bug
End-to-end testing fails after PR #307 if using MongoDB as the database provider. This happens because the new
parent
property (#307) that includes areas data (eitherProvince
,Regency
, orDistrict
) containsid
property which is brought from MongoDB.Before this, the
id
property was removed automatically by the transformerTransformInterceptor
(see the implementations in PR #179, #185, and #187).To Reproduce
Steps to reproduce the behavior:
npm run test:e2e
Expected behavior
End-to-end testing successful without any errors.
Screenshots or Error logs
Suggestion
It gets more complicated if we have to delete the
id
property from all area data inparent
property. Therefore, it will be better if we bring back the generated MongoDBid
to the response. We just need to explain this MongoDB behavior in the documentation.The text was updated successfully, but these errors were encountered: