Skip to content

Commit

Permalink
Make unit test deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
c0d1ngm0nk3y committed Jun 3, 2024
1 parent 310195e commit e8e8c58
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions linked_module_resolver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,17 @@ func testLinkedModuleResolver(t *testing.T, context spec.G, it spec.S) {

context("when the destination cannot be scaffolded", func() {
it.Before(func() {
Expect(os.WriteFile(filepath.Join(layerPath, "sub-dir"), nil, 0400)).To(Succeed())
err := os.WriteFile(filepath.Join(workspace, "package-lock.json"), []byte(`{
"packages": {
"module-1": {
"resolved": "src/packages/module",
"link": true
}
}
}`), 0600)
Expect(err).NotTo(HaveOccurred())

Expect(os.Mkdir(filepath.Join(layerPath, "sub-dir"), 0400)).To(Succeed())
})

it("returns an error", func() {
Expand Down Expand Up @@ -209,7 +219,17 @@ func testLinkedModuleResolver(t *testing.T, context spec.G, it spec.S) {

context("when the destination cannot be scaffolded", func() {
it.Before(func() {
Expect(os.WriteFile(filepath.Join(otherLayerPath, "sub-dir"), nil, 0400)).To(Succeed())
err := os.WriteFile(filepath.Join(workspace, "package-lock.json"), []byte(`{
"packages": {
"module-1": {
"resolved": "src/packages/module",
"link": true
}
}
}`), 0600)
Expect(err).NotTo(HaveOccurred())

Expect(os.Mkdir(filepath.Join(otherLayerPath, "sub-dir"), 0400)).To(Succeed())
})

it("returns an error", func() {
Expand Down

0 comments on commit e8e8c58

Please sign in to comment.