forked from vieter-v/vieter
fix(build): change tests to use BuildConfig instead
parent
882a9a60a9
commit
b6168a3060
|
@ -1,42 +1,48 @@
|
||||||
module build
|
module build
|
||||||
|
|
||||||
import models { Target }
|
import models
|
||||||
|
|
||||||
fn test_create_build_script_git_branch() {
|
fn test_create_build_script_git_branch() {
|
||||||
target := Target{
|
config := BuildConfig{
|
||||||
id: 1
|
target_id: 1
|
||||||
kind: 'git'
|
kind: 'git'
|
||||||
url: 'https://examplerepo.com'
|
url: 'https://examplerepo.com'
|
||||||
branch: 'main'
|
branch: 'main'
|
||||||
repo: 'vieter'
|
repo: 'vieter'
|
||||||
|
base_image: 'not-used:latest'
|
||||||
}
|
}
|
||||||
build_script := create_build_script('https://example.com', target, 'x86_64')
|
|
||||||
|
build_script := create_build_script('https://example.com', config, 'x86_64')
|
||||||
expected := $embed_file('build_script_git_branch.sh')
|
expected := $embed_file('build_script_git_branch.sh')
|
||||||
|
|
||||||
assert build_script == expected.to_string().trim_space()
|
assert build_script == expected.to_string().trim_space()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_create_build_script_git() {
|
fn test_create_build_script_git() {
|
||||||
target := Target{
|
config := BuildConfig{
|
||||||
id: 1
|
target_id: 1
|
||||||
kind: 'git'
|
kind: 'git'
|
||||||
url: 'https://examplerepo.com'
|
url: 'https://examplerepo.com'
|
||||||
repo: 'vieter'
|
repo: 'vieter'
|
||||||
|
base_image: 'not-used:latest'
|
||||||
}
|
}
|
||||||
build_script := create_build_script('https://example.com', target, 'x86_64')
|
|
||||||
|
build_script := create_build_script('https://example.com', config, 'x86_64')
|
||||||
expected := $embed_file('build_script_git.sh')
|
expected := $embed_file('build_script_git.sh')
|
||||||
|
|
||||||
assert build_script == expected.to_string().trim_space()
|
assert build_script == expected.to_string().trim_space()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_create_build_script_url() {
|
fn test_create_build_script_url() {
|
||||||
target := Target{
|
config := BuildConfig{
|
||||||
id: 1
|
target_id: 1
|
||||||
kind: 'url'
|
kind: 'url'
|
||||||
url: 'https://examplerepo.com'
|
url: 'https://examplerepo.com'
|
||||||
repo: 'vieter'
|
repo: 'vieter'
|
||||||
|
base_image: 'not-used:latest'
|
||||||
}
|
}
|
||||||
build_script := create_build_script('https://example.com', target, 'x86_64')
|
|
||||||
|
build_script := create_build_script('https://example.com', config, 'x86_64')
|
||||||
expected := $embed_file('build_script_url.sh')
|
expected := $embed_file('build_script_url.sh')
|
||||||
|
|
||||||
assert build_script == expected.to_string().trim_space()
|
assert build_script == expected.to_string().trim_space()
|
||||||
|
|
Loading…
Reference in New Issue