|
16 | 16 |
|
17 | 17 | import {describe, expect, vi, test, beforeEach, afterEach, it} from 'vitest'; |
18 | 18 | import fs from 'fs'; |
| 19 | +import handlebars from 'handlebars'; |
19 | 20 | import os from 'os'; |
20 | 21 | import path from 'path'; |
21 | 22 | import * as rimraf from 'rimraf'; |
22 | 23 |
|
23 | 24 | import {mockArch, mockPlatform} from '../.helpers/os.js'; |
24 | 25 |
|
| 26 | +import {limaYamlData, limaUndockVersion} from '../../src/docker/assets.js'; |
25 | 27 | import {Install, InstallSourceArchive, InstallSourceImage} from '../../src/docker/install.js'; |
26 | 28 |
|
27 | 29 | const tmpDir = fs.mkdtempSync(path.join(process.env.TEMP || os.tmpdir(), 'docker-install-')); |
@@ -128,3 +130,25 @@ aarch64:https://cloud-images.ubuntu.com/releases/23.10/release-20231011/ubuntu-2 |
128 | 130 | ]); |
129 | 131 | }); |
130 | 132 | }); |
| 133 | + |
| 134 | +describe('limaYamlData', () => { |
| 135 | + it('renders the pinned undock version in the release URL', () => { |
| 136 | + const instance = handlebars.create(); |
| 137 | + instance.registerHelper('stringify', function (obj) { |
| 138 | + return new instance.SafeString(JSON.stringify(obj)); |
| 139 | + }); |
| 140 | + const limaCfg = instance.compile(limaYamlData)({ |
| 141 | + customImages: [], |
| 142 | + daemonConfig: {}, |
| 143 | + dockerSock: '/tmp/docker.sock', |
| 144 | + gitCommit: 'master', |
| 145 | + srcType: 'image', |
| 146 | + srcArchiveVersion: '29.0.0', |
| 147 | + srcArchiveChannel: 'stable', |
| 148 | + srcImageTag: '29.0.0', |
| 149 | + undockVersion: limaUndockVersion |
| 150 | + }); |
| 151 | + |
| 152 | + expect(limaCfg).toContain(`url="https://github.com/crazy-max/undock/releases/download/v${limaUndockVersion}/undock_${limaUndockVersion}_linux_$arch.tar.gz"`); |
| 153 | + }); |
| 154 | +}); |
0 commit comments