7 lines
1.0 KiB
JavaScript
7 lines
1.0 KiB
JavaScript
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); });
|