Files
freeCodeCamp/client/src/pages/challenges.test.ts
Nicholas Carrigan (he/him) 592a2846d3 chore: pass CI (#42635)
* chore: eslint on icons

* chore: eslint spacer element

* chore: remove more eslint

* fix: existing lint issues

* fix: misnamed import

* fix: client now builds!

* fix: tsc errors

* fix: more linting issues
2021-06-30 20:52:17 +05:30

39 lines
1.2 KiB
TypeScript

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck
/**
* TODO:
* Passing incomplete objects here is causing TS to be angry.
* We should either make the expected properties optional, or reevaluate
* these tests.
*/
import toLearnPath from '../utils/to-learn-path';
import { withPrefix } from 'gatsby';
describe('toLearnPath', () => {
it('should return a string', () => {
expect(typeof toLearnPath({})).toBe('string');
});
it('should include /learn', () => {
expect(toLearnPath({})).toMatch(withPrefix('/learn'));
});
it('should include superBlock after learn', () => {
expect(toLearnPath({ superBlock: 'testSuper' })).toBe(
withPrefix('/learn/testSuper')
);
});
it('should include superBlock, then block after learn', () => {
expect(toLearnPath({ superBlock: 'testSuper', block: 'testBlock' })).toBe(
withPrefix('/learn/testSuper/testBlock')
);
});
it('should include superBlock, block, then challenge after learn', () => {
expect(
toLearnPath({
superBlock: 'testSuper',
block: 'testBlock',
challenge: 'testChallenge'
})
).toBe(withPrefix('/learn/testSuper/testBlock/testChallenge'));
});
});