47 行
1.2 KiB
TypeScript
47 行
1.2 KiB
TypeScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
import { createReleaseSetCheckBody } from '../src/releaseSetRequest'
|
||
|
|
|
||
|
|
const base = {
|
||
|
|
appKey: 'app',
|
||
|
|
targetModuleId: 'orders',
|
||
|
|
platform: 'ANDROID' as const,
|
||
|
|
appVersion: '8.0.0',
|
||
|
|
nativeApiLevel: 2,
|
||
|
|
nativeBaselineId: 'native-sha256',
|
||
|
|
installedModules: [
|
||
|
|
{
|
||
|
|
moduleId: 'app',
|
||
|
|
type: 'app' as const,
|
||
|
|
version: '1.0.0',
|
||
|
|
appVersionRange: '>=8.0.0 <9.0.0',
|
||
|
|
},
|
||
|
|
],
|
||
|
|
}
|
||
|
|
|
||
|
|
test('release-set check sends all server compatibility inputs', () => {
|
||
|
|
assert.deepEqual(createReleaseSetCheckBody({ ...base, userId: 'user-1' }), {
|
||
|
|
...base,
|
||
|
|
userId: 'user-1',
|
||
|
|
})
|
||
|
|
})
|
||
|
|
|
||
|
|
test('release-set check blocks locally when native baseline is unavailable', () => {
|
||
|
|
assert.throws(
|
||
|
|
() => createReleaseSetCheckBody({ ...base, nativeBaselineId: ' ' }),
|
||
|
|
/Native baseline is required/,
|
||
|
|
)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('release-set check blocks locally when app or native API identity is unavailable', () => {
|
||
|
|
assert.throws(
|
||
|
|
() => createReleaseSetCheckBody({ ...base, appVersion: ' ' }),
|
||
|
|
/Full-app version is required/,
|
||
|
|
)
|
||
|
|
assert.throws(
|
||
|
|
() => createReleaseSetCheckBody({ ...base, nativeApiLevel: 0 }),
|
||
|
|
/Native API level must be positive/,
|
||
|
|
)
|
||
|
|
})
|