Skip to content

Commit ab5e6d9

Browse files
committed
Update detection tests [#167707118]
1 parent 176903e commit ab5e6d9

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

cmd/detect/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func runDetect(context detect.Detect) (int, error) {
7070
Requires: []buildplan.Required{{
7171
Name: node.Dependency,
7272
Version: version,
73-
Metadata: buildplan.Metadata{"launch": true, "version-source": versionSource},
73+
Metadata: buildplan.Metadata{"launch": true, node.VersionSource: versionSource},
7474
}},
7575
})
7676
}

cmd/detect/main_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func testDetect(t *testing.T, when spec.G, it spec.S) {
4343
})
4444

4545
it("should request the node version in the buildpack.yml", func() {
46-
buildPlan = getStandardBuildplanWithNodeVersion(buildpackYamlVersion)
46+
buildPlan = getStandardBuildplanWithNodeVersion(buildpackYamlVersion, "buildpack.yml")
4747
runDetectAndExpectBuildplan(factory, buildPlan, t)
4848
})
4949
})
@@ -54,7 +54,7 @@ func testDetect(t *testing.T, when spec.G, it spec.S) {
5454
})
5555

5656
it("should request the node version in the .nvmrc file", func() {
57-
buildPlan = getStandardBuildplanWithNodeVersion(nvmrcVersion)
57+
buildPlan = getStandardBuildplanWithNodeVersion(nvmrcVersion, ".nvmrc")
5858
runDetectAndExpectBuildplan(factory, buildPlan, t)
5959
})
6060
})
@@ -66,7 +66,7 @@ func testDetect(t *testing.T, when spec.G, it spec.S) {
6666
})
6767

6868
it("should request the node version in the buildpack.yml", func() {
69-
buildPlan = getStandardBuildplanWithNodeVersion(buildpackYamlVersion)
69+
buildPlan = getStandardBuildplanWithNodeVersion(buildpackYamlVersion, "buildpack.yml")
7070
runDetectAndExpectBuildplan(factory, buildPlan, t)
7171
})
7272
})
@@ -78,7 +78,7 @@ func testDetect(t *testing.T, when spec.G, it spec.S) {
7878
})
7979

8080
it("should request the node version in the .nvmrc", func() {
81-
buildPlan = getStandardBuildplanWithNodeVersion(nvmrcVersion)
81+
buildPlan = getStandardBuildplanWithNodeVersion(nvmrcVersion, "buildpack.yml")
8282
runDetectAndExpectBuildplan(factory, buildPlan, t)
8383
})
8484
})
@@ -95,14 +95,15 @@ func runDetectAndExpectBuildplan(factory *test.DetectFactory, buildplan buildpla
9595
Expect(factory.Plans.Plan).To(Equal(buildplan))
9696
}
9797

98-
func getStandardBuildplanWithNodeVersion(version string) buildplan.Plan {
98+
func getStandardBuildplanWithNodeVersion(version, versionSource string) buildplan.Plan {
9999
return buildplan.Plan{
100100
Provides: []buildplan.Provided{{Name: node.Dependency}},
101101
Requires: []buildplan.Required{{
102102
Name: node.Dependency,
103103
Version: version,
104104
Metadata: buildplan.Metadata{
105-
"launch": true,
105+
"launch": true,
106+
node.VersionSource: versionSource,
106107
}}},
107108
}
108109
}

0 commit comments

Comments
 (0)