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 e40ab0145f
commit 09773f7c5c
7 changed files with 160 additions and 30 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()