Update tests for version resolution

This commit is contained in:
Renée Kooi 2024-04-26 09:51:59 +02:00
parent e3b63a8160
commit c921de45d4

18
test.js
View File

@ -5,29 +5,35 @@ const {
} = require('./versions')
async function test () {
assert.deepEqual(resolveCommit('linux', '0.6.0+4b48fccad'), {
assert.deepEqual(resolveCommit('x64', 'linux', '0.6.0+4b48fccad'), {
downloadUrl: 'https://ziglang.org/builds/zig-linux-x86_64-0.6.0+4b48fccad.tar.xz',
variantName: 'zig-linux-x86_64-0.6.0+4b48fccad',
version: '0.6.0+4b48fccad'
})
assert.deepEqual(resolveCommit('win32', '0.6.0+4b48fccad'), {
assert.deepEqual(resolveCommit('x64', 'win32', '0.6.0+4b48fccad'), {
downloadUrl: 'https://ziglang.org/builds/zig-windows-x86_64-0.6.0+4b48fccad.zip',
variantName: 'zig-windows-x86_64-0.6.0+4b48fccad',
version: '0.6.0+4b48fccad'
})
assert.deepEqual(await resolveVersion('linux', '0.7.0'), {
assert.deepEqual(await resolveVersion('x64', 'linux', '0.7.0'), {
downloadUrl: 'https://ziglang.org/download/0.7.0/zig-linux-x86_64-0.7.0.tar.xz',
variantName: 'zig-linux-x86_64-0.7.0',
version: '0.7.0'
})
assert.deepEqual(await resolveVersion('win32', '0.4.0'), {
assert.deepEqual(await resolveVersion('x64', 'win32', '0.4.0'), {
downloadUrl: 'https://ziglang.org/download/0.4.0/zig-windows-x86_64-0.4.0.zip',
variantName: 'zig-windows-x86_64-0.4.0',
version: '0.4.0'
})
await assert.doesNotReject(resolveVersion('linux', 'master'))
await assert.doesNotReject(resolveVersion('win32', 'master'))
assert.deepEqual(await resolveVersion('arm64', 'darwin', '0.11.0'), {
downloadUrl: 'https://ziglang.org/download/0.11.0/zig-macos-aarch64-0.11.0.tar.xz',
variantName: 'zig-macos-aarch64-0.11.0',
version: '0.11.0'
})
await assert.doesNotReject(resolveVersion('x64', 'linux', 'master'))
await assert.doesNotReject(resolveVersion('x64', 'win32', 'master'))
await assert.doesNotReject(resolveVersion('arm64', 'darwin', 'master'))
}
test().catch((error) => {