1 | import fs from 'fs'
|
2 | import path from 'path'
|
3 | import DockerCompiler from '../src/DockerCompiler'
|
4 | import NixGenerator from '../src/NixGenerator'
|
5 | import MockUrlFetcher from './MockUrlFetcher'
|
6 | import { fixture } from './test-functions'
|
7 |
|
8 | const urlFetcher = new MockUrlFetcher()
|
9 |
|
10 | jest.setTimeout(30 * 60 * 1000)
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | test('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 | })
|