Files
freeCodeCamp/client/src/utils/to-learn-path.test.ts
Victor Duarte 7c6524186e refactor(client): docs, ts and test challenges (#42978)
* 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>
2021-08-10 15:22:39 +02:00

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`);
});
});