Skip to content

Commit

Permalink
test(TogglApi): ✅ increase test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ulisesantana committed Dec 18, 2023
1 parent 122c200 commit bdb56ac
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions test/infrastructure/data-sources/toggl.api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,26 @@ describe('Toggl API should', () => {
httpMock.reset()
})

it('get user info', async () => {
const data = {a: 42, b: 'meh'}
httpMock
.onGet(`${TogglApi.baseUrl}/api/v9/me?with_related_data=true`)
.reply(200, data)
describe('get user info', () => {
it('successfully', async () => {
const data = {a: 42, b: 'meh'}
httpMock
.onGet(`${TogglApi.baseUrl}/api/v9/me?with_related_data=true`)
.reply(200, data)

const result = await TogglApi.getUserInfo('irrelevant', http)
const result = await TogglApi.getUserInfo('irrelevant', http)

expect(result).to.deep.equal(data)
expect(result).to.deep.equal(data)
})

it('throwing error', async () => {
httpMock
.onGet(`${TogglApi.baseUrl}/api/v9/me?with_related_data=true`)
.reply(500)


await expect(TogglApi.getUserInfo('irrelevant', http)).to.rejected
})
})

describe('create time entry', () => {
Expand Down

0 comments on commit bdb56ac

Please sign in to comment.