-
Notifications
You must be signed in to change notification settings - Fork 45
/
node_test.go
65 lines (57 loc) · 1.56 KB
/
node_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package nodejs
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/zeabur/zbpack/pkg/types"
)
// TODO)) type-safe builder
func TestGetContextBasedOnMeta_MapShouldBeCorrect(t *testing.T) {
meta := getContextBasedOnMeta(types.PlanMeta{
"nodeVersion": "16",
"installCmd": "RUN npm install",
"buildCmd": "npm run build",
"startCmd": "npm run start",
})
assert.Equal(t, meta, TemplateContext{
NodeVersion: "16",
InstallCmd: "RUN npm install",
BuildCmd: "npm run build",
StartCmd: "npm run start",
})
}
func TestGetContextBasedOnMeta_WithOutputdirAndSPAFramework(t *testing.T) {
meta := getContextBasedOnMeta(types.PlanMeta{
"nodeVersion": "16",
"installCmd": "RUN npm install",
"buildCmd": "npm run build",
"startCmd": "npm run start",
"outputDir": "dist",
"framework": "wtfisthis",
})
assert.Equal(t, meta, TemplateContext{
NodeVersion: "16",
InstallCmd: "RUN npm install",
BuildCmd: "npm run build",
StartCmd: "npm run start",
Framework: "wtfisthis",
OutputDir: "dist",
})
}
func TestGetContextBasedOnMeta_WithOutputdirAndMPAFramework(t *testing.T) {
meta := getContextBasedOnMeta(types.PlanMeta{
"nodeVersion": "16",
"installCmd": "RUN npm install",
"buildCmd": "npm run build",
"startCmd": "npm run start",
"outputDir": "dist",
"framework": "hexo",
})
assert.Equal(t, meta, TemplateContext{
NodeVersion: "16",
InstallCmd: "RUN npm install",
BuildCmd: "npm run build",
StartCmd: "npm run start",
Framework: "hexo",
OutputDir: "dist",
})
}