Add a new pet to the store

Parliament Test

test

test

Header

var a = 1;
const syntaxHighlighter = require('../');

test('should highlight a block of code', () => {
  const code = syntaxHighlighter('var a = 1;', 'javascript');

  expect(code).toEqual(expect.stringMatching(/tomorrow-night/));
  expect(code).toEqual(expect.stringMatching(/cm-s-tomorrow-night/));
  expect(code).toBe('<span class="cm-s-tomorrow-night"><span class="cm-keyword">var</span> <span class="cm-def">a</span> <span class="cm-operator">=</span> <span class="cm-number">1</span>;</span>');
});

test('should sanitize plain text language', () => {
  expect(syntaxHighlighter('& < > " \' /', 'text')).toBe('&amp; &lt; &gt; &quot; &#39; &#x2F;');
});

test('should work with modes', () => {
  expect(syntaxHighlighter('{ "a": 1 }', 'json')).toBe('<span class="cm-s-tomorrow-night">{ <span class="cm-property">"a"</span>: <span class="cm-number">1</span> }</span>');
});

test('should have a dark theme', () => {
  expect(syntaxHighlighter('{ "a": 1 }', 'json', true)).toContain('<span class="cm-s-tomorrow-night">');
});
console.log(1)
Language
Click Try It! to start a request and see the response here!