Skip to content

Commit

Permalink
update test and change merge to object.assign
Browse files Browse the repository at this point in the history
  • Loading branch information
restuwahyu13 committed Feb 13, 2021
1 parent b3881e5 commit 6a690e6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions __test__/coreApi.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ describe('CoreApi', () => {
expect(isType(res.status_code)).toStrictEqual('string')
expect(isType(res.token_id)).toStrictEqual('string')
expect(res.status_code).toStrictEqual('200')
tokenId = res.token_id
done()
tokenId = res.token_id
})

it('able to card register cc', async (done) => {
Expand All @@ -65,8 +65,8 @@ describe('CoreApi', () => {
expect(isType(res.status_code)).toStrictEqual('string')
expect(isType(res.saved_token_id)).toStrictEqual('string')
expect(res.status_code).toStrictEqual('200')
savedTokenId = res.saved_token_id
done()
savedTokenId = res.saved_token_id
})

it('fail to card point inquiry 402', () => {
Expand Down
16 changes: 7 additions & 9 deletions __test__/iris.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,14 @@ describe('Iris.js', () => {
done()
})

it('fail 400 to createBeneficiaries with unset api key', () => {
it('fail 400 to createBeneficiaries with unset api key', (done) => {
const spyIris = jest.spyOn(iris, 'createBeneficiaries')
return iris
.createBeneficiaries({})
.then((res) => {
expect(spyIris).toHaveBeenCalled()
expect(spyIris).toHaveBeenCalledTimes(1)
expect(res).toStrictEqual(null)
})
.catch((e) => expect(e.message).toMatch(/400/))
return iris.createBeneficiaries({}).catch((e) => {
expect(spyIris).toHaveBeenCalled()
expect(spyIris).toHaveBeenCalledTimes(1)
expect(e.message).toMatch(/400/)
done()
})
})

it('fail to createBeneficiaries: account duplicated / already been taken', () => {
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"test:watch": "jest --watchAll",
"test:coverage": "jest --coverage",
"test:coveralls": "jest --coverage && coveralls < coverage/lcov.info",
"lint": "eslint src/**/*.{ts,spec.ts,test.ts} --fix",
"format": "prettier src/**/*.{ts,spec.ts,test.ts} --write",
"lint": "eslint src/**/*.ts --fix",
"format": "prettier src/**/*.ts --write",
"lint:fix": "npm run format && npm run lint"
},
"author": {
Expand Down Expand Up @@ -54,7 +54,7 @@
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.167",
"@types/lodash": "^4.14.168",
"@types/node": "^14.14.20",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/apiConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class ApiConfig {
}

this.parsedOptions = _.pick(options, ['isProduction', 'serverKey', 'clientKey'])
this.mergedConfig = _.merge({}, currentConfig, this.parsedOptions)
this.mergedConfig = Object.assign(currentConfig, this.parsedOptions)

this.isProduction = options ? this.mergedConfig.isProduction : this.isProduction
this.serverKey = options ? this.mergedConfig.serverKey : this.serverKey
Expand Down

0 comments on commit 6a690e6

Please sign in to comment.