1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-06 17:40:58 +00:00

fix tests

Signed-off-by: Casey Lee <cplee@nektos.com>
This commit is contained in:
Casey Lee 2020-02-13 11:47:38 -08:00
parent e67e06809c
commit 7183c74cd0
6 changed files with 159 additions and 29 deletions

View file

@ -3,6 +3,7 @@ package runner
import (
"testing"
"github.com/nektos/act/pkg/model"
"github.com/stretchr/testify/assert"
)
@ -12,6 +13,12 @@ func TestEvaluate(t *testing.T) {
Config: &Config{
Workdir: ".",
},
Run: &model.Run{
JobID: "job1",
Workflow: &model.Workflow{
Name: "test-workflow",
},
},
}
ee := rc.NewExpressionEvaluator()
@ -36,6 +43,15 @@ func TestEvaluate(t *testing.T) {
{"join('hello','mona')", "hello mona", ""},
{"toJSON({'foo':'bar'})", "{\n \"foo\": \"bar\"\n}", ""},
{"hashFiles('**/package-lock.json')", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", ""},
{"success()", "true", ""},
{"failure()", "false", ""},
{"always()", "true", ""},
{"cancelled()", "false", ""},
{"github.workflow", "test-workflow", ""},
{"github.actor", "nektos/act", ""},
{"github.run_id", "1", ""},
{"github.run_number", "1", ""},
{"runner.os", "Linux", ""},
}
for _, table := range tables {
@ -59,6 +75,12 @@ func TestInterpolate(t *testing.T) {
Config: &Config{
Workdir: ".",
},
Run: &model.Run{
JobID: "job1",
Workflow: &model.Workflow{
Name: "test-workflow",
},
},
}
ee := rc.NewExpressionEvaluator()