feat(public-berths): expose booleans, metric variants, timestamps
Bring the public berth feed to verbatim NocoDB parity (all fields except Price, which is held pending an explicit policy decision per the audit follow-ups Q4). Adds: - Berth Approved (boolean) - Water Depth (number) - Width Is Minimum / Water Depth Is Minimum (boolean) - Length / Width / Draft / Water Depth / Nominal Boat Size (Metric) - CreatedAt / UpdatedAt (ISO strings, useful for cache invalidation) Booleans pass through as nullable to preserve NocoDB's tri-state checkbox semantics (true / false / unset). Test fixtures cover the new fields end-to-end including the null-passthrough case. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,6 +105,32 @@ describe('toPublicBerth', () => {
|
||||
expect(out.Access).toBe('Car (3t) to Vessel');
|
||||
});
|
||||
|
||||
it('exposes booleans + metric variants + timestamps for verbatim NocoDB parity', () => {
|
||||
const out = toPublicBerth(makeBerth(), null, false);
|
||||
expect(out['Berth Approved']).toBe(false);
|
||||
expect(out['Water Depth']).toBe(16.08);
|
||||
expect(out['Width Is Minimum']).toBe(false);
|
||||
expect(out['Water Depth Is Minimum']).toBe(false);
|
||||
expect(out['Length (Metric)']).toBe(63);
|
||||
expect(out['Width (Metric)']).toBe(14.19);
|
||||
expect(out['Draft (Metric)']).toBe(4.42);
|
||||
expect(out['Water Depth (Metric)']).toBe(4.9);
|
||||
expect(out['Nominal Boat Size (Metric)']).toBe(60.96);
|
||||
expect(out.CreatedAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
|
||||
expect(out.UpdatedAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
|
||||
});
|
||||
|
||||
it('preserves null booleans (NocoDB checkbox-tri-state parity)', () => {
|
||||
const out = toPublicBerth(
|
||||
makeBerth({ berthApproved: null, widthIsMinimum: null, waterDepthIsMinimum: null }),
|
||||
null,
|
||||
false,
|
||||
);
|
||||
expect(out['Berth Approved']).toBeNull();
|
||||
expect(out['Width Is Minimum']).toBeNull();
|
||||
expect(out['Water Depth Is Minimum']).toBeNull();
|
||||
});
|
||||
|
||||
it('inlines map data when present', () => {
|
||||
const out = toPublicBerth(makeBerth(), makeMapData(), false);
|
||||
expect(out['Map Data']).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user