Skip to content

Commit

Permalink
test(bake): add coverage for missing --output scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
crhntr committed Jul 24, 2024
1 parent ff8d61a commit 2322221
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions internal/commands/bake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,18 @@ var _ = Describe("Bake", func() {
Expect(string(fakeBakeRecordFunc.productTemplate)).To(Equal("some-interpolated-metadata"), "it gives the bake recorder the product template")
})

FContext("when the output flag is not set", func() {
When("the tile-name flag is not provided", func() {
It("uses the tile as the filename prefix", func() {
err := bake.Execute([]string{})
Expect(err).To(Not(HaveOccurred()))
Expect(fakeTileWriter.WriteCallCount()).To(Equal(1))
_, input := fakeTileWriter.WriteArgsForCall(0)
Expect(input.OutputFile).To(Equal(filepath.Join("tile-v1.2.3.pivotal")))
})
})
})

Context("when bake configuration is in the Kilnfile", func() {
BeforeEach(func() {
bake = bake.WithKilnfileFunc(func(s string) (cargo.Kilnfile, error) {
Expand Down Expand Up @@ -448,6 +460,7 @@ var _ = Describe("Bake", func() {
When("a the tile flag is passed", func() {
It("it uses the value from the bake configuration with the correct name", func() {
err := bake.Execute([]string{
"bake",
"--tile-name=p-each",
})
Expect(err).To(Not(HaveOccurred()))
Expand Down

0 comments on commit 2322221

Please sign in to comment.