Skip to content

Commit

Permalink
feat(#169): fixing unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
inromualdo committed Jul 1, 2024
1 parent dcc713a commit d57aadb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
},
"scripts": {
"cp-package-json": "cp package.json ./src",
"test": "npx ts-mocha test/services/place-factory.spec.ts",
"test": "npx ts-mocha test/{,**}/*.spec.ts",
"build": "npm run cp-package-json && npx tsc",
"lint": "npx eslint --color --cache .",
"start": "node dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/cht-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class ChtSession {
public readonly axiosInstance: AxiosInstance;
public readonly sessionToken: string;

private constructor(authInfo: AuthenticationInfo, sessionToken: string, username: string, facilityId: string) {
constructor(authInfo: AuthenticationInfo, sessionToken: string, username: string, facilityId: string) {
this.authInfo = authInfo;
this.username = username;
this.facilityId = facilityId;
Expand Down
5 changes: 3 additions & 2 deletions test/services/place-factory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,13 @@ describe('services/place-factory.ts', () => {
fakeFormData.hierarchy_GRANDPARENT = 'no match';

chtApi.getPlacesWithType
.resolves([grandParent])
.onSecondCall().resolves([remotePlace]);
.resolves([grandParent]);

const place: Place = await PlaceFactory.createOne(fakeFormData, contactType, sessionCache, chtApi);
expectInvalidProperties(place.validationErrors, ['hierarchy_PARENT', 'hierarchy_GRANDPARENT'], 'Cannot find');

chtApi.getPlacesWithType
.resolves([remotePlace]);
fakeFormData.hierarchy_GRANDPARENT = '';
const edited = await PlaceFactory.editOne(place.id, fakeFormData, sessionCache, chtApi);
expect(edited.validationErrors).to.be.empty;
Expand Down

0 comments on commit d57aadb

Please sign in to comment.