Added vitest and broke up components

This commit is contained in:
Mike Conrad
2023-08-25 21:43:38 -04:00
parent 01a9bc6cb4
commit 84502ca5d4
11 changed files with 712 additions and 53 deletions

14
src/token.test.ts Normal file
View File

@ -0,0 +1,14 @@
// @vitest-environment jsdom
import { assert, expect, test } from 'vitest'
import {displayToken} from './token'
test('a 6 digit token is displayed', () => {
const token = displayToken('ABCDEFGHIJKLMNOP')
expect(token.length).toBe(6)
})
test('displayed totp token is numeric only', () => {
const token = displayToken('ABCDEFGHIJKLMNOP')
expect(isNaN(+token)).toBeFalsy()
})