1 |
|
2 |
|
3 | import 'babel-polyfill'
|
4 | import path from 'path'
|
5 |
|
6 | import File from '../../src/File'
|
7 | import ParseFileListing from '../../src/Rules/ParseFileListing'
|
8 | import { initializeRule } from '../helpers'
|
9 |
|
10 | import type { ParsedLog } from '../../src/types'
|
11 |
|
12 | import type { RuleDefinition } from '../helpers'
|
13 |
|
14 | async function initialize ({
|
15 | RuleClass = ParseFileListing,
|
16 | parameters = [{
|
17 | filePath: 'FileListing.fls'
|
18 | }],
|
19 | ...rest }: RuleDefinition = {}) {
|
20 | return initializeRule({ RuleClass, parameters, ...rest })
|
21 | }
|
22 |
|
23 | describe('ParseFileListing', () => {
|
24 | it('verifies that file listing is successfully parsed.', async (done) => {
|
25 | const { rule } = await initialize()
|
26 | const expectedLog: ParsedLog = {
|
27 | calls: [],
|
28 | inputs: [
|
29 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/LaTeX.tex',
|
30 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/output/biber.aux',
|
31 | '/usr/local/texlive/2016/texmf-dist/fonts/map/fontname/texfonts.map',
|
32 | '/usr/local/texlive/2016/texmf-dist/fonts/tfm/public/cm/cmbx10.tfm',
|
33 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/etexcmds.sty',
|
34 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifluatex.sty',
|
35 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ifpdf.sty',
|
36 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/infwarerr.sty',
|
37 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty',
|
38 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/ltxcmds.sty',
|
39 | '/usr/local/texlive/2016/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty',
|
40 | '/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.sty',
|
41 | '/usr/local/texlive/2016/texmf-dist/tex/generic/xstring/xstring.tex',
|
42 | '/usr/local/texlive/2016/texmf-dist/tex/latex/base/article.cls',
|
43 | '/usr/local/texlive/2016/texmf-dist/tex/latex/base/ifthen.sty',
|
44 | '/usr/local/texlive/2016/texmf-dist/tex/latex/base/size10.clo',
|
45 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/bbx/numeric.bbx',
|
46 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/bbx/standard.bbx',
|
47 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/biblatex.cfg',
|
48 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/biblatex.def',
|
49 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/biblatex.sty',
|
50 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/blx-compat.def',
|
51 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/blx-dm.def',
|
52 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/cbx/numeric.cbx',
|
53 | '/usr/local/texlive/2016/texmf-dist/tex/latex/biblatex/lbx/english.lbx',
|
54 | '/usr/local/texlive/2016/texmf-dist/tex/latex/etoolbox/etoolbox.sty',
|
55 | '/usr/local/texlive/2016/texmf-dist/tex/latex/graphics/keyval.sty',
|
56 | '/usr/local/texlive/2016/texmf-dist/tex/latex/logreq/logreq.def',
|
57 | '/usr/local/texlive/2016/texmf-dist/tex/latex/logreq/logreq.sty',
|
58 | '/usr/local/texlive/2016/texmf-dist/tex/latex/oberdiek/kvoptions.sty',
|
59 | '/usr/local/texlive/2016/texmf-dist/tex/latex/url/url.sty',
|
60 | '/usr/local/texlive/2016/texmf-dist/web2c/texmf.cnf',
|
61 | '/usr/local/texlive/2016/texmf-var/web2c/pdftex/latex.fmt',
|
62 | '/usr/local/texlive/2016/texmf.cnf'
|
63 | ].map(filePath => rule.normalizePath(path.resolve(rule.rootPath, filePath))),
|
64 | outputs: [
|
65 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/output/biber.aux',
|
66 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/output/biber.bcf',
|
67 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/output/biber.dvi',
|
68 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/output/biber.log',
|
69 | '/home/tburton/Documents/git/dicy/spec/fixtures/file-types/output/biber.run.xml'
|
70 | ].map(filePath => rule.normalizePath(path.resolve(rule.rootPath, filePath))),
|
71 | messages: []
|
72 | }
|
73 |
|
74 | await rule.parse()
|
75 |
|
76 | const parsedFileListing: ?File = await rule.getFile('FileListing.fls-ParsedFileListing')
|
77 |
|
78 | expect(parsedFileListing).toBeDefined()
|
79 | if (!parsedFileListing) return
|
80 |
|
81 | expect(parsedFileListing.value).toEqual(expectedLog)
|
82 |
|
83 | done()
|
84 | })
|
85 | })
|