UNPKG

1.21 kBJavaScriptView Raw
1/* @flow */
2
3import 'babel-polyfill'
4
5import File from '../../src/File'
6import ParseSplitIndexStdErr from '../../src/Rules/ParseSplitIndexStdErr'
7import { initializeRule } from '../helpers'
8
9describe('ParseSplitIndexStdErr', () => {
10 it('verifies that all error messages are successfully parsed.', async (done) => {
11 const parsedOutPath = 'foo.log-ParsedSplitIndexStdErr'
12 const { rule } = await initializeRule({
13 RuleClass: ParseSplitIndexStdErr,
14 filePath: 'error-warning.tex',
15 parameters: [{
16 filePath: 'foo.log-SplitIndexStdErr',
17 value: 'Cannot read raw index file foo.idx at /usr/local/bin/splitindex line 86.'
18 }]
19 })
20
21 const messages = [{
22 severity: 'error',
23 name: 'splitindex',
24 text: 'Cannot read raw index file foo.idx',
25 source: {
26 file: '/usr/local/bin/splitindex',
27 range: { start: 86, end: 86 }
28 }
29 }]
30
31 await rule.parse()
32
33 const parsedLog: ?File = await rule.getFile(parsedOutPath)
34
35 expect(parsedLog).toBeDefined()
36 if (!parsedLog) return
37
38 expect(parsedLog.value).toBeDefined()
39 if (!parsedLog.value) return
40
41 expect(parsedLog.value.messages).toEqual(messages)
42
43 done()
44 })
45})