15 lines
463 B
TypeScript
15 lines
463 B
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { parseDurationToSeconds } from './token.util';
|
|
|
|
describe('parseDurationToSeconds', () => {
|
|
it('parses time units', () => {
|
|
expect(parseDurationToSeconds('15m', 1)).toBe(900);
|
|
expect(parseDurationToSeconds('2h', 1)).toBe(7200);
|
|
expect(parseDurationToSeconds('10', 1)).toBe(10);
|
|
});
|
|
|
|
it('falls back on invalid input', () => {
|
|
expect(parseDurationToSeconds('abc', 42)).toBe(42);
|
|
});
|
|
});
|