1 |
|
2 |
|
3 | import 'babel-polyfill'
|
4 |
|
5 | import File from '../../src/File'
|
6 | import ParseLaTeXMagic from '../../src/Rules/ParseLaTeXMagic'
|
7 | import { initializeRule } from '../helpers'
|
8 |
|
9 | import type { RuleDefinition } from '../helpers'
|
10 |
|
11 | async function initialize ({
|
12 | RuleClass = ParseLaTeXMagic,
|
13 | filePath = 'file-types/LaTeX_standalone.tex',
|
14 | parameters = [{
|
15 | filePath: 'LaTeX_standalone.tex'
|
16 | }],
|
17 | ...rest }: RuleDefinition = {}) {
|
18 | return initializeRule({ RuleClass, filePath, parameters, ...rest })
|
19 | }
|
20 |
|
21 | describe('ParseLaTeXMagic', () => {
|
22 | it('verifies that all log messages are successfully parsed.', async (done) => {
|
23 | const { rule } = await initialize()
|
24 | const magic = {
|
25 | jobNames: ['job-1', 'job 2', 'job-3'],
|
26 | jobs: {
|
27 | 'job-1': { outputDirectory: 'output' },
|
28 | 'job 2': { shellEscape: 'enabled' }
|
29 | },
|
30 | syncTeX: 'yes',
|
31 | '$PATH': ['wibble', '']
|
32 | }
|
33 |
|
34 | await rule.parse()
|
35 |
|
36 | const parsedMagic: ?File = await rule.getFile('LaTeX_standalone.tex-ParsedLaTeXMagic')
|
37 |
|
38 | expect(parsedMagic).toBeDefined()
|
39 | if (!parsedMagic) return
|
40 |
|
41 | expect(parsedMagic.value).toEqual(magic)
|
42 |
|
43 | done()
|
44 | })
|
45 | })
|