Extract versioned Model Delivery shared contracts

This commit is contained in:
tomchukk committed 2026-09-07 19:20:09 +03:00
commit 9133b921a7
15 files changed
+1185

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { totalPrice, pullResponseSchema, ssoSettingsSchema } from '../dist/index.js';
test('published JS preserves fixed-point half-up pricing', () => { assert.equal(totalPrice(1001, 150), 1502); assert.equal(totalPrice(12345, 0), 0); });
test('delta cursors round-trip beyond JS safe integer precision', () => { const cursor = '9007199254740993'; assert.equal(pullResponseSchema.parse({ changes: [], nextCursor: cursor, hasMore: false }).nextCursor, cursor); assert.equal(pullResponseSchema.safeParse({ changes: [], nextCursor: Number(cursor), hasMore: false }).success, false); });
test('enabled access restriction cannot have an empty allowlist', () => { assert.equal(ssoSettingsSchema.safeParse({ enabled: true, issuer: '', discoveryUrl: '', clientId: '', redirectUri: '', scopes: 'openid', authMethod: 'client_secret_post', offlineAccess: false, promptConsent: false, displayNameClaim: 'name', groupAccessEnabled: true, allowedGroups: [] }).success, false); });