test if only known parameters are replaced

This commit is contained in:
Jacob Overgaard
2024-03-11 16:14:19 +01:00
parent 638c1139f9
commit 586758dd4e

View File

@@ -29,6 +29,11 @@ describe('createRoutePathBuilder', () => {
expect(buildPath({ param1: 'value1' })).to.eq('/test/value1/path/value1/');
});
it('should not consider parameters that are not in the params object', () => {
const buildPath = createRoutePathBuilder('test/:param1/path/:param2');
expect(buildPath({ param1: 'value1' })).to.eq('/test/value1/path/:param2/');
});
it('should support complex objects as parameters with a custom toString method', () => {
const buildPath = createRoutePathBuilder('test/:param1/path/:param2');
const obj = {