-
Notifications
You must be signed in to change notification settings - Fork 291
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(clerk-js): Added tests for normalizeRoutingOptions utility function
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
packages/clerk-js/src/ui/common/__tests__/authPropHelpers.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { normalizeRoutingOptions } from '../../../utils/authPropHelpers'; | ||
|
||
describe('auth prop helpers', () => { | ||
describe('normalizeRoutingOptions', () => { | ||
it("returns routing: 'path' if path was provided and no routing was provided", () => { | ||
expect(normalizeRoutingOptions({ path: 'test' })).toEqual({ routing: 'path', path: 'test' }); | ||
}); | ||
|
||
it('returns routing: null if path was provided and routing was null (avoid breaking integrations)', () => { | ||
// @ts-expect-error Need to test this case | ||
expect(normalizeRoutingOptions({ path: 'test', routing: null })).toEqual({ routing: null, path: 'test' }); | ||
}); | ||
|
||
it('returns the same options if routing was provided (any routing) and path was provided (avoid breaking integrations)', () => { | ||
expect(normalizeRoutingOptions({ routing: 'path', path: 'test' })).toEqual({ routing: 'path', path: 'test' }); | ||
expect(normalizeRoutingOptions({ routing: 'hash', path: 'test' })).toEqual({ routing: 'hash', path: 'test' }); | ||
expect(normalizeRoutingOptions({ routing: 'virtual' })).toEqual({ routing: 'virtual' }); | ||
}); | ||
}); | ||
}); |