const assert = require('node:assert/strict'); const test = require('node:test'); const { assertRouteIdMatchesBody } = require('../src/helpers'); test('assertRouteIdMatchesBody allows matching top-level body id', () => { assert.doesNotThrow(() => assertRouteIdMatchesBody({ params: { id: 'route-id' }, body: { id: 'route-id' }, }), ); }); test('assertRouteIdMatchesBody allows matching data body id', () => { assert.doesNotThrow(() => assertRouteIdMatchesBody({ params: { id: 'route-id' }, body: { data: { id: 'route-id' } }, }), ); }); test('assertRouteIdMatchesBody rejects mismatched body id', () => { assert.throws( () => assertRouteIdMatchesBody({ params: { id: 'route-id' }, body: { data: { id: 'body-id' } }, }), /Request body id does not match route id/, ); });