Skip to content

Commit

Permalink
fix: make customer and department nullable, add realistic sample data…
Browse files Browse the repository at this point in the history
… in test (#113)

* fix: make customer and department nullable

* test: update test
  • Loading branch information
braaar authored Sep 8, 2023
1 parent 54539b7 commit 0bad1de
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
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

0 comments on commit 0bad1de

Please sign in to comment.