25 lines
967 B
JavaScript
25 lines
967 B
JavaScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { matchesManualScheduleScope } from './phase3-carrier-schedule-queries.mjs'
|
|
|
|
const expected = { customerId: '10001', oceanBookingId: '20001', containerBookingId: null }
|
|
|
|
test('does not reuse a schedule from the same booking when the container scope differs', () => {
|
|
assert.equal(matchesManualScheduleScope({
|
|
id: '30001', customerId: '10001', oceanBookingId: '20001', containerBookingId: '40001',
|
|
}, expected), false)
|
|
})
|
|
|
|
test('does not reuse a schedule whose customer scope is unknown', () => {
|
|
assert.equal(matchesManualScheduleScope({
|
|
id: '30001', oceanBookingId: '20001', containerBookingId: null,
|
|
}, expected), false)
|
|
})
|
|
|
|
test('reuses a schedule only when customer, booking and container scopes all match', () => {
|
|
assert.equal(matchesManualScheduleScope({
|
|
id: '30001', customerId: 10001, oceanBookingId: 20001, containerBookingId: null,
|
|
}, expected), true)
|
|
})
|