Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make customer and department nullable, add realistic sample data in test #113

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 27 additions & 33 deletions src/calls/contact/__tests__/contact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,26 @@ describe('activity class', () => {
versionDigest: 'Checksum not yet supported for this endpoint',
values: [
{
id: 1734852,
version: 1,
url: 'api.tripletex.io/v2/contact/1734852',
firstName: 'Simen A. W. Olsen',
lastName: 'API Testuser',
displayName: 'Simen A. W. Olsen API Testuser',
email: '[email protected]',
phoneNumberMobileCountry: {
id: 161,
url: 'api.tripletex.io/v2/country/161',
"id" : 9004148,
"version" : 1,
"url" : "tripletex.no/v2/contact/88885",
"firstName" : "Fastprisavtale",
"lastName" : "",
"displayName" : "Fastprisavtale",
"email" : "",
"phoneNumberMobileCountry" : {
"id" : 161,
"url" : "tripletex.no/v2/country/161"
},
phoneNumberMobile: '',
phoneNumberWork: '',
customer: {
id: 88885,
url: 'api.tripletex.io/v2/customer/88885',
"phoneNumberMobile" : "",
"phoneNumberWork" : "",
"customer" : null,
"department" : {
"id" : 88885,
"url" : "tripletex.no/v2/department/88885"
},
department: {
id: 88885,
url: 'api.tripletex.io/v2/department/88885',
},
isInactive: false,
},
"isInactive" : false
}
],
});
const entries = await client.list();
Expand All @@ -56,27 +53,24 @@ describe('activity class', () => {
expect(entries.body.values).toMatchInlineSnapshot(`
Array [
Object {
"customer": Object {
"id": 88885,
"url": "api.tripletex.io/v2/customer/88885",
},
"customer": null,
"department": Object {
"id": 88885,
"url": "api.tripletex.io/v2/department/88885",
"url": "tripletex.no/v2/department/88885",
},
"displayName": "Simen A. W. Olsen API Testuser",
"email": "[email protected]",
"firstName": "Simen A. W. Olsen",
"id": 1734852,
"displayName": "Fastprisavtale",
"email": "",
"firstName": "Fastprisavtale",
"id": 9004148,
"isInactive": false,
"lastName": "API Testuser",
"lastName": "",
"phoneNumberMobile": "",
"phoneNumberMobileCountry": Object {
"id": 161,
"url": "api.tripletex.io/v2/country/161",
"url": "tripletex.no/v2/country/161",
},
"phoneNumberWork": "",
"url": "api.tripletex.io/v2/contact/1734852",
"url": "tripletex.no/v2/contact/88885",
"version": 1,
},
]
Expand Down
4 changes: 2 additions & 2 deletions src/calls/contact/models/contact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const contactRt = rt.Record({
customer: rt.Record({
id: rt.Number,
url: rt.String,
}),
}).nullable(),
department: rt.Record({
id: rt.Number,
url: rt.String,
}),
}).nullable(),
isInactive: rt.Boolean.nullable().optional(),
})

Expand Down