This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
dagger/pkg/universe.dagger.io/yarn/test/yarn-test.cue
Solomon Hykes e6b5fd3de9 yarn.#Build: simpler API, better tests
* Remove mandatory 'cache' field
* New 'name' field to customize cache IDs instead
* Simplify and expand tests

Signed-off-by: Solomon Hykes <solomon@dagger.io>
2022-02-08 23:02:03 +00:00

61 lines
954 B
CUE

package yarn
import (
"dagger.io/dagger"
"dagger.io/dagger/engine"
"universe.dagger.io/yarn"
)
dagger.#Plan & {
inputs: directories: {
testdata: path: "./testdata"
testdata2: path: "./testdata2"
}
actions: tests: {
simple: {
build: yarn.#Build & {
source: inputs.directories.testdata.contents
}
verify: #AssertFile & {
input: build.output
path: "test"
contents: "output\n"
}
}
// Run yarn.#Build with a custom name
customName: {
build: yarn.#Build & {
name: "My Build"
source: inputs.directories.testdata.contents
}
verify: #AssertFile & {
input: build.output
path: "test"
contents: "output\n"
}
}
}
}
// Make an assertion on the contents of a file
#AssertFile: {
input: dagger.#FS
path: string
contents: string
_read: engine.#ReadFile & {
"input": input
"path": path
}
actual: _read.contents
// Assertion
contents: actual
}