redoc/src/services/__tests__/prism.test.ts
2017-10-12 00:01:37 +03:00

20 lines
560 B
TypeScript

import { highlight, mapLang } from '../../utils/highlight';
describe('prism.js helpers', () => {
test('mapLang should map "json" to "js"', () => {
expect(mapLang('json')).toBe('js');
});
test('mapLang should map to "clike" by default', () => {
expect(mapLang('non-existring')).toBe('clike');
});
test('highlight js code', () => {
expect(highlight('const t = 10;', 'js')).toMatchSnapshot();
});
test('highlight raw text should just return text', () => {
expect(highlight('Hello world', 'clike')).toBe('Hello world');
});
});