Files
PicHost/server/utils/app-version.test.ts
O96u d8c1303c32 release: v1.1.3 — dual-domain separation and URL options
Add admin/image domain separation with host isolation middleware,
optional hide-folder public URLs, GitHub release update check, and
Lucky/Nginx deployment docs. Switch license to GPL-3.0-only.
2026-08-27 12:13:58 +08:00

21 lines
702 B
TypeScript

import { describe, expect, it } from 'vitest'
import { isVersionNewer, normalizeVersionTag, parseVersionParts } from './app-version'
describe('app-version', () => {
it('normalizes tag prefixes', () => {
expect(normalizeVersionTag('v1.1.2')).toBe('1.1.2')
expect(normalizeVersionTag('V2.0.0')).toBe('2.0.0')
})
it('parses dotted versions', () => {
expect(parseVersionParts('1.10.3')).toEqual([1, 10, 3])
})
it('detects newer versions', () => {
expect(isVersionNewer('1.2.0', '1.1.2')).toBe(true)
expect(isVersionNewer('1.1.2', '1.1.2')).toBe(false)
expect(isVersionNewer('1.1.1', '1.1.2')).toBe(false)
expect(isVersionNewer('2.0.0', '1.9.9')).toBe(true)
})
})