UNPKG

966 BJavaScriptView Raw
1/* @flow */
2
3import 'babel-polyfill'
4
5import Sage from '../../src/Rules/Sage'
6import { initializeRule } from '../helpers'
7
8import type { RuleDefinition } from '../helpers'
9
10async function initialize ({
11 RuleClass = Sage,
12 parameters = [{
13 filePath: 'Sage.sage'
14 }],
15 ...rest }: RuleDefinition = {}) {
16 return initializeRule({ RuleClass, parameters, ...rest })
17}
18
19describe('Sage', () => {
20 describe('constructCommand', () => {
21 it('returns correct arguments and command options for sage file.', async (done) => {
22 const { rule } = await initialize()
23
24 expect(rule.constructCommand()).toEqual({
25 args: ['sage', '{{$BASE_0}}'],
26 cd: '$ROOTDIR_0',
27 severity: 'error',
28 outputs: [
29 '$DIR_0/$NAME_0.sout',
30 '$DIR_0/$NAME_0.sage.cmd',
31 '$DIR_0/$NAME_0.scmd',
32 '$FILEPATH_0.py'
33 ],
34 globbedOutputs: ['$DIR_0/sage-plots-for-$JOB.tex/*']
35 })
36
37 done()
38 })
39 })
40})