task-svr/test/utils.test.ts
2024-04-17 14:08:07 +08:00

30 lines
987 B
TypeScript

import { describe, expect } from '@jest/globals'
import { isValidVoucherCode, isValidShareCode } from '../src/common/Utils'
describe('Common Utils Tests', () => {
it('should return true for voucher code', async () => {
// create a mock for the User class
const code = 'testeBZ2leXC'
let result = isValidVoucherCode(code)
expect(result).toBe(true)
})
it('should return false for voucher code', async () => {
// create a mock for the User class
const code = 'testeBZ2le'
let result = isValidVoucherCode(code)
expect(result).toBe(false)
})
it('should return true for share code', async () => {
// create a mock for the User class
const code = 'testeBZ2le'
let result = isValidShareCode(code)
expect(result).toBe(true)
})
it('should return false for share code', async () => {
// create a mock for the User class
const code = 'testeBZ2leXC'
let result = isValidShareCode(code)
expect(result).toBe(false)
})
})