Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Jun 8, 2022
1 parent 373c22b commit 269c27f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/web-runtime/tests/unit/components/UploadInfo.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,18 @@ describe('UploadInfo component', () => {
expect(uploadedItems.length).toBe(2)
})
})
describe('getRemainingTime method', () => {
it.each([
{ ms: 1000, expected: 'Few seconds left' },
{ ms: 1000 * 60 * 30, expected: '30 minutes left' },
{ ms: 1000 * 60 * 60, expected: '1 hour left' },
{ ms: 1000 * 60 * 60 * 2, expected: '2 hours left' }
])('should return the proper string', ({ ms, expected }) => {
const wrapper = getShallowWrapper()
const estimatedTime = wrapper.vm.getRemainingTime(ms)
expect(estimatedTime).toBe(expected)
})
})
})

function createStore() {
Expand Down

0 comments on commit 269c27f

Please sign in to comment.