Skip to content

Commit 39de436

Browse files
committed
fix: Error handling on delete, and not to expect a response payload
1 parent 4d4950c commit 39de436

File tree

1 file changed

+12
-2
lines changed
  • test/typescript/terraform-cloud

1 file changed

+12
-2
lines changed

test/typescript/terraform-cloud/test.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,19 @@ describe("full integration test", () => {
6767
},
6868
},
6969
);
70-
const res = await response.json();
7170

72-
return res.data.id;
71+
switch (response.status) {
72+
case 204:
73+
return true;
74+
case 404:
75+
throw new Error(
76+
`Workspace not found, or unauthorized: ${response.statusText}`,
77+
);
78+
case 403:
79+
throw new Error(
80+
`not authorized to delete workspace: ${response.statusText}`,
81+
);
82+
}
7383
}
7484

7585
beforeEach(async () => {

0 commit comments

Comments
 (0)