mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 20:10:56 +00:00
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { WagonReadiness } from '@edr/types';
|
|
|
|
import {
|
|
requiredWagonReadiness,
|
|
wagonReadinessMatchesSchedule,
|
|
} from './wagon-readiness.util';
|
|
|
|
describe('wagonReadinessMatchesSchedule', () => {
|
|
it('requires IMPORT_READY for IMPORT schedules', () => {
|
|
expect(requiredWagonReadiness('IMPORT')).toBe(WagonReadiness.ImportReady);
|
|
expect(
|
|
wagonReadinessMatchesSchedule(WagonReadiness.ImportReady, 'IMPORT'),
|
|
).toBe(true);
|
|
expect(
|
|
wagonReadinessMatchesSchedule(WagonReadiness.ExportReady, 'IMPORT'),
|
|
).toBe(false);
|
|
});
|
|
|
|
it('requires EXPORT_READY for EXPORT schedules', () => {
|
|
expect(requiredWagonReadiness('EXPORT')).toBe(WagonReadiness.ExportReady);
|
|
expect(
|
|
wagonReadinessMatchesSchedule(WagonReadiness.ExportReady, 'EXPORT'),
|
|
).toBe(true);
|
|
expect(
|
|
wagonReadinessMatchesSchedule(WagonReadiness.ImportReady, 'EXPORT'),
|
|
).toBe(false);
|
|
});
|
|
|
|
it('allows any readiness for DOMESTIC schedules', () => {
|
|
expect(requiredWagonReadiness('DOMESTIC')).toBeNull();
|
|
expect(
|
|
wagonReadinessMatchesSchedule(WagonReadiness.ExportReady, 'DOMESTIC'),
|
|
).toBe(true);
|
|
});
|
|
});
|