mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-13 04:03:30 +00:00
Single RemoteError with a merge-extensible, domain-prefixed code map; owners throw at the failure point; streams surface marked failures; clients consume ctx.remote directly with isRemoteFailure as the only discrimination point and construct no failure instances.
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { canonicalClientTimeZone } from '@deepseek-ai/dsh-util-time'
|
|
|
|
describe('canonicalClientTimeZone', () => {
|
|
it('accepts UTC and Area/Location names unchanged', () => {
|
|
expect(canonicalClientTimeZone('UTC')).toBe('UTC')
|
|
expect(canonicalClientTimeZone('Asia/Shanghai')).toBe('Asia/Shanghai')
|
|
expect(canonicalClientTimeZone('Europe/London')).toBe('Europe/London')
|
|
})
|
|
|
|
it('answers the platform-canonical name rather than the alias asked for', () => {
|
|
// A durable record is compared against the zone a later reader derives, so
|
|
// an alias must not survive the boundary. Which name each alias group
|
|
// resolves to is the runtime's ICU data, not this library's choice.
|
|
const canonical = canonicalClientTimeZone('Asia/Chongqing')
|
|
expect(canonical).not.toBe('Asia/Chongqing')
|
|
expect(canonicalClientTimeZone(canonical ?? '')).toBe(canonical)
|
|
})
|
|
|
|
it('refuses blank, padded, abbreviated, and single-segment names', () => {
|
|
for (const value of ['', ' ', ' UTC', 'UTC ', 'CST', 'GMT+8', 'Asia', 'utc']) {
|
|
expect(canonicalClientTimeZone(value)).toBeUndefined()
|
|
}
|
|
})
|
|
|
|
it('refuses a well-formed name the platform does not support', () => {
|
|
expect(canonicalClientTimeZone('Not/A_Real_Zone')).toBeUndefined()
|
|
})
|
|
})
|