Skip to content

Commit 2730a5b

Browse files
Missing exit code added in unit test cases
1 parent 482724c commit 2730a5b

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

test/unit/commands/app/create.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,10 @@ describe("app:create", () => {
206206
.reply(200, { organizations: mock.organizations })
207207
)
208208
.command(["app:create", "--data-dir", process.cwd()])
209-
.do(({ stdout }) =>
210-
expect(stdout).to.contain(messages.FILE_GENERATION_FAILURE)
211-
)
209+
.exit(1)
210+
.do(({ stdout }) => {
211+
expect(stdout).to.includes(messages.FILE_GENERATION_FAILURE);
212+
})
212213
.it("Boilerplate clone exits with status code 1");
213214
});
214215

@@ -236,6 +237,7 @@ describe("app:create", () => {
236237
api.post("/manifests", { ...manifestData, name: "test-app" }).reply(400)
237238
)
238239
.command(["app:create", "--data-dir", process.cwd()])
240+
.exit(1)
239241
.do(({ stdout }) =>
240242
expect(stdout).to.contain(messages.APP_CREATION_CONSTRAINT_FAILURE)
241243
)
@@ -272,6 +274,7 @@ describe("app:create", () => {
272274
"--config",
273275
resolve(process.cwd(), "test", "unit", "mock", "config.json"),
274276
])
277+
.exit(1)
275278
.do(({ stdout }) =>
276279
expect(stdout).to.contain(messages.APP_CREATION_CONSTRAINT_FAILURE)
277280
)
@@ -320,6 +323,7 @@ describe("app:create", () => {
320323
})
321324
)
322325
.command(["app:create", "--data-dir", process.cwd()])
326+
.exit(1)
323327
.do(({ stdout }) =>
324328
expect(stdout).to.contain("Dependency installation failed.!")
325329
)

test/unit/commands/app/update.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ describe("app:update", () => {
121121
.reply(200, { organizations: mock.organizations })
122122
)
123123
.command(["app:update"])
124+
.exit(1)
124125
.do(({ stdout }) => expect(stdout).to.contain(messages.MAX_RETRY_LIMIT))
125126
.it("should fail with manifest max retry message");
126127
});
@@ -150,6 +151,7 @@ describe("app:update", () => {
150151
"--app-manifest",
151152
join(process.cwd(), "test", "unit", "config", "manifest.json"),
152153
])
154+
.exit(1)
153155
.do(({ stdout }) => expect(stdout).to.contain(messages.MAX_RETRY_LIMIT))
154156
.it("should fail with max retry message");
155157
});
@@ -184,6 +186,7 @@ describe("app:update", () => {
184186
"--app-manifest",
185187
join(process.cwd(), "test", "unit", "config", "manifest.json"),
186188
])
189+
.exit(1)
187190
.do(({ stdout }) =>
188191
expect(stdout).to.contain(messages.APP_VERSION_MISS_MATCH)
189192
)
@@ -225,6 +228,7 @@ describe("app:update", () => {
225228
"--app-manifest",
226229
join(process.cwd(), "test", "unit", "config", "manifest.json"),
227230
])
231+
.exit(1)
228232
.do(({ stdout }) => expect(stdout).to.contain(messages.INVALID_APP_ID))
229233
.it("update app should fail with 400 status code");
230234
});
@@ -264,6 +268,7 @@ describe("app:update", () => {
264268
"--app-manifest",
265269
join(process.cwd(), "test", "unit", "config", "manifest.json"),
266270
])
271+
.exit(1)
267272
.do(({ stdout }) => expect(stdout).to.contain(messages.APP_INVALID_ORG))
268273
.it("update app should fail with 403 status code");
269274
});

0 commit comments

Comments
 (0)