UNPKG

973 BPlain TextView Raw
1import fs from 'fs'
2import path from 'path'
3import DockerCompiler from '../src/DockerCompiler'
4import NixGenerator from '../src/NixGenerator'
5import MockUrlFetcher from './MockUrlFetcher'
6import { fixture } from './test-functions'
7
8const urlFetcher = new MockUrlFetcher()
9
10jest.setTimeout(30 * 60 * 1000)
11
12/**
13 * When applied to an environment with packages from several languages, generate should return
14 * Dockerfile with R and the packages installed
15 */
16test('generate:packages', async () => {
17 let expectedNixfile = fs.readFileSync(path.join(fixture('multi-lang-for-nix'), 'default.nix.expected'), 'utf8')
18
19 const compiler = new DockerCompiler(urlFetcher)
20 let environ = await compiler.compile('file://' + fixture('multi-lang-for-nix'), false, false)
21
22 const generator = new NixGenerator(urlFetcher, undefined)
23 let nixfile = generator.generate(environ, fixture('multi-lang-for-nix')).split('\n').slice(1).join('\n')
24
25 expect(nixfile).toEqual(expectedNixfile)
26})