UNPKG

1.96 kBJavaScriptView Raw
1/* @flow */
2
3import 'babel-polyfill'
4
5import File from '../../src/File'
6import ParseSplitIndexStdOut from '../../src/Rules/ParseSplitIndexStdOut'
7import { initializeRule } from '../helpers'
8
9describe('ParseSplitIndexStdOut', () => {
10 it('verifies that all error messages are successfully parsed.', async (done) => {
11 const parsedOutPath = 'foo.log-ParsedSplitIndexStdOut'
12 const { rule } = await initializeRule({
13 RuleClass: ParseSplitIndexStdOut,
14 filePath: 'error-warning.tex',
15 parameters: [{
16 filePath: 'foo.log-SplitIndexStdOut',
17 value: `splitindex.pl 0.1
18Copyright (c) 2002 Markus Kohm <kohm@gmx.de>
19New index file job-1-theories.idx
20New index file job-1-persons.idx
21Close job-1-persons.idx
22Close job-1-theories.idx
23
24job-1-theories.idx with 1 lines
25job-1-persons.idx with 1 lines`
26 }]
27 })
28 const expectedParsedLog = {
29 inputs: [],
30 outputs: ['job-1-theories.idx', 'job-1-persons.idx'],
31 messages: [{
32 severity: 'info',
33 name: 'splitindex',
34 text: 'New index file job-1-theories.idx'
35 }, {
36 severity: 'info',
37 name: 'splitindex',
38 text: 'New index file job-1-persons.idx'
39 }, {
40 severity: 'info',
41 name: 'splitindex',
42 text: 'Close job-1-persons.idx'
43 }, {
44 severity: 'info',
45 name: 'splitindex',
46 text: 'Close job-1-theories.idx'
47 }, {
48 severity: 'info',
49 name: 'splitindex',
50 text: 'job-1-theories.idx with 1 lines'
51 }, {
52 severity: 'info',
53 name: 'splitindex',
54 text: 'job-1-persons.idx with 1 lines'
55 }],
56 calls: []
57 }
58
59 await rule.parse()
60
61 const parsedLog: ?File = await rule.getFile(parsedOutPath)
62
63 expect(parsedLog).toBeDefined()
64 if (!parsedLog) return
65
66 expect(parsedLog.value).toBeDefined()
67 if (!parsedLog.value) return
68
69 expect(parsedLog.value).toEqual(expectedParsedLog)
70
71 done()
72 })
73})