mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-30 16:01:10 -04:00
* refactor(client): relocate to learn path tests file * refactor(client): add docs for to learn path Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> * fix: order imports Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
32 lines
891 B
TypeScript
32 lines
891 B
TypeScript
import { withPrefix } from 'gatsby';
|
|
|
|
import toLearnPath from './to-learn-path';
|
|
|
|
describe('To learn path utility (toLearnPath)', () => {
|
|
const learn = withPrefix('/learn');
|
|
|
|
it('should include /learn', () => {
|
|
expect(toLearnPath({})).toMatch(`${learn}`);
|
|
});
|
|
|
|
it('should include superBlock after learn', () => {
|
|
expect(toLearnPath({ superBlock: 'testSuper' })).toBe(`${learn}/testSuper`);
|
|
});
|
|
|
|
it('should include superBlock, then block after learn', () => {
|
|
expect(toLearnPath({ block: 'testBlock', superBlock: 'testSuper' })).toBe(
|
|
`${learn}/testSuper/testBlock`
|
|
);
|
|
});
|
|
|
|
it('should include superBlock, block, then challenge after learn', () => {
|
|
expect(
|
|
toLearnPath({
|
|
block: 'testBlock',
|
|
challenge: 'testChallenge',
|
|
superBlock: 'testSuper'
|
|
})
|
|
).toBe(`${learn}/testSuper/testBlock/testChallenge`);
|
|
});
|
|
});
|