41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { test } from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { normalizeStatus } from '../src/shared/api/status.ts'
|
|
|
|
test('test_normalize_lower_to_upper', () => {
|
|
assert.equal(normalizeStatus('success'), 'SUCCESS')
|
|
assert.equal(normalizeStatus('failed'), 'FAILED')
|
|
assert.equal(normalizeStatus('pending'), 'PENDING')
|
|
})
|
|
|
|
test('test_normalize_mixed_case', () => {
|
|
assert.equal(normalizeStatus('rUnNiNg'), 'RUNNING')
|
|
})
|
|
|
|
test('test_normalize_with_hyphen', () => {
|
|
assert.equal(normalizeStatus('in-progress'), 'IN_PROGRESS')
|
|
assert.equal(normalizeStatus('file-ready'), 'FILE_READY')
|
|
})
|
|
|
|
test('test_normalize_null', () => {
|
|
assert.equal(normalizeStatus(null), '')
|
|
})
|
|
|
|
test('test_normalize_undefined', () => {
|
|
assert.equal(normalizeStatus(undefined), '')
|
|
})
|
|
|
|
test('test_normalize_empty_string', () => {
|
|
assert.equal(normalizeStatus(''), '')
|
|
})
|
|
|
|
test('test_normalize_unknown_passthrough', () => {
|
|
assert.equal(normalizeStatus('SYNCING'), 'SYNCING')
|
|
assert.equal(normalizeStatus('QUEUED'), 'QUEUED')
|
|
})
|
|
|
|
test('test_normalize_whitespace_padded', () => {
|
|
assert.equal(normalizeStatus(' running '), 'RUNNING')
|
|
assert.equal(normalizeStatus(' '), '')
|
|
})
|