Files
baserow/web-frontend/test/unit/builder/utils/path.spec.js
T
2023-04-11 13:41:43 +00:00

20 lines
709 B
JavaScript

import { getPathParams } from '@baserow/modules/builder/utils/path'
describe('getPathParams', () => {
test('that it can find no params', () => {
expect(getPathParams('/test')).toEqual([])
})
test('that it can find one param', () => {
expect(getPathParams('/test/:id')).toEqual(['id'])
})
test('that it can find multiple params', () => {
expect(getPathParams('/test/:id/:test')).toEqual(['id', 'test'])
})
test('that it can find multiple params without slashes', () => {
expect(getPathParams('/test/:id-:test')).toEqual(['id', 'test'])
})
test('that it can find multiple params with double colons', () => {
expect(getPathParams('/test/::test')).toEqual(['test'])
})
})