Files
fotospiel-app/resources/js/admin/__tests__/api.test.ts
Codex Agent 4c37f874bd
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled
Preserve null remaining_events in package normalization
2026-01-16 14:11:44 +01:00

20 lines
805 B
TypeScript

import { describe, expect, it } from 'vitest';
import { normalizeTenantPackage } from '../api';
describe('normalizeTenantPackage', () => {
it('keeps remaining_events null when payload is null', () => {
const normalized = normalizeTenantPackage({ id: 1, remaining_events: null, used_events: 0 } as any);
expect(normalized.remaining_events).toBeNull();
});
it('keeps remaining_events null when payload is missing', () => {
const normalized = normalizeTenantPackage({ id: 1, used_events: 0 } as any);
expect(normalized.remaining_events).toBeNull();
});
it('coerces remaining_events to number when provided', () => {
const normalized = normalizeTenantPackage({ id: 1, remaining_events: '2', used_events: 0 } as any);
expect(normalized.remaining_events).toBe(2);
});
});