Files
grafana/public/app/plugins/datasource/tempo/syntax.test.ts
Josh Hunt 3c6e0e8ef8 Chore: ESlint import order (#44959)
* Add and configure eslint-plugin-import

* Fix the lint:ts npm command

* Autofix + prettier all the files

* Manually fix remaining files

* Move jquery code in jest-setup to external file to safely reorder imports

* Resolve issue caused by circular dependencies within Prometheus

* Update .betterer.results

* Fix missing // @ts-ignore

* ignore iconBundle.ts

* Fix missing // @ts-ignore
2022-04-22 14:33:13 +01:00

21 lines
1.1 KiB
TypeScript

import Prism from 'prismjs';
import { tokenizer } from './syntax';
describe('Loki syntax', () => {
it('should highlight Loki query correctly', () => {
expect(Prism.highlight('key=value', tokenizer, 'tempo')).toBe(
'<span class="token key attr-name">key</span><span class="token operator">=</span><span class="token value">value</span>'
);
expect(Prism.highlight('root.ip=172.123.0.1', tokenizer, 'tempo')).toBe(
'<span class="token key attr-name">root.ip</span><span class="token operator">=</span><span class="token value">172.123.0.1</span>'
);
expect(Prism.highlight('root.name="http get /config"', tokenizer, 'tempo')).toBe(
'<span class="token key attr-name">root.name</span><span class="token operator">=</span><span class="token value">"http get /config"</span>'
);
expect(Prism.highlight('key=value key2=value2', tokenizer, 'tempo')).toBe(
'<span class="token key attr-name">key</span><span class="token operator">=</span><span class="token value">value</span> <span class="token key attr-name">key2</span><span class="token operator">=</span><span class="token value">value2</span>'
);
});
});