1import { 2 escapeBackticksAndOctals, 3 getHotReplaceTemplate, 4 wrapDevelopmentCSS, 5 pathToHtmlSafeName, 6} from '../css'; 7 8describe(escapeBackticksAndOctals, () => { 9 it(`should escape backticks and octals`, () => { 10 expect(escapeBackticksAndOctals('`')).toEqual('\\`'); 11 expect(escapeBackticksAndOctals('`\\0')).toEqual('\\`\\\\0'); 12 }); 13}); 14 15describe(wrapDevelopmentCSS, () => { 16 it(`should transform css in dev mode`, async () => { 17 const result = await wrapDevelopmentCSS({ 18 filename: 'test.css', 19 src: 'body { color: red; }', 20 }); 21 22 expect(result).toMatchSnapshot(); 23 expect(result).toMatch(/expo-css-hmr/); 24 }); 25}); 26 27describe(pathToHtmlSafeName, () => { 28 it(`converts filepath to safe name`, () => { 29 expect(pathToHtmlSafeName('foo')).toEqual('foo'); 30 expect(pathToHtmlSafeName('../123/abc/something.module.css')).toEqual( 31 '___123_abc_something_module_css' 32 ); 33 }); 34}); 35 36describe(getHotReplaceTemplate, () => { 37 it(`should generate the correct template`, () => { 38 expect(getHotReplaceTemplate('foo')).toMatchSnapshot(); 39 }); 40}); 41