19 lines
694 B
TypeScript
19 lines
694 B
TypeScript
import assert from 'node:assert/strict'
|
|
import test from 'node:test'
|
|
|
|
import { isMaritimePort } from './maritime.js'
|
|
|
|
test('accepts curated coastal LOCODE ports', () => {
|
|
assert.equal(isMaritimePort({ locode: 'NGLAG' }), true)
|
|
assert.equal(isMaritimePort({ locode: 'CDBNW' }), true)
|
|
})
|
|
|
|
test('rejects inland ports even when UN/LOCODE function 1 is present', () => {
|
|
assert.equal(isMaritimePort({ locode: 'CMGOU', function_code: '1-34----' }), false)
|
|
assert.equal(isMaritimePort({ locode: 'CGOYO', function_code: '1-3-----' }), false)
|
|
})
|
|
|
|
test('accepts an explicitly curated database record', () => {
|
|
assert.equal(isMaritimePort({ locode: 'CUSTOM', is_maritime_port: true }), true)
|
|
})
|