Skip to content

Commit

Permalink
Add getLayerPath unit tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
onurtemizkan committed Mar 20, 2024
1 parent 0c1f5a0 commit 8a92001
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,28 @@ describe('Utils', () => {
assert.strictEqual(message, '2');
});
});

describe('getLayerPath', () => {
it('should return path for a string route definition', () => {
assert.strictEqual(utils.getLayerPath(['/test']), '/test');
});

it('should return path for a regex route definition', () => {
assert.strictEqual(utils.getLayerPath([/^\/test$/]), '/^\\/test$/');
});

it('should return path for an array of route definitions', () => {
assert.strictEqual(
utils.getLayerPath([/^\/test$/, '/test']),
'/^\\/test$/,/test'
);
});

it('should return path for a mixed array of route definitions', () => {
assert.strictEqual(
utils.getLayerPath([/^\/test$/, '/test', /^\/test$/]),
'/^\\/test$/,/test,/^\\/test$'
);
});
});
});

0 comments on commit 8a92001

Please sign in to comment.