Skip to content

Commit de06991

Browse files
committed
fix: use arrow functions for nock body matching in resourceManager tests
1 parent 72715b3 commit de06991

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

src/gcp/resourceManager.spec.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ describe("resourceManager", () => {
3737
.reply(200, initialPolicy);
3838

3939
nock("https://cloudresourcemanager.googleapis.com")
40-
.post(`/v1/projects/${PROJECT_ID}:setIamPolicy`, {
41-
policy: expectedPolicy,
42-
updateMask: "bindings",
40+
.post(`/v1/projects/${PROJECT_ID}:setIamPolicy`, (body: any) => {
41+
return body.updateMask === "bindings" && JSON.stringify(body.policy) === JSON.stringify(expectedPolicy);
4342
})
4443
.reply(200, expectedPolicy);
4544

@@ -82,9 +81,8 @@ describe("resourceManager", () => {
8281
.reply(200, initialPolicy);
8382

8483
nock("https://cloudresourcemanager.googleapis.com")
85-
.post(`/v1/projects/${PROJECT_ID}:setIamPolicy`, {
86-
policy: expectedPolicy,
87-
updateMask: "bindings",
84+
.post(`/v1/projects/${PROJECT_ID}:setIamPolicy`, (body: any) => {
85+
return body.updateMask === "bindings" && JSON.stringify(body.policy) === JSON.stringify(expectedPolicy);
8886
})
8987
.reply(200, expectedPolicy);
9088

@@ -115,9 +113,8 @@ describe("resourceManager", () => {
115113
.reply(200, initialPolicy);
116114

117115
nock("https://cloudresourcemanager.googleapis.com")
118-
.post(`/v1/projects/${PROJECT_ID}:setIamPolicy`, {
119-
policy: initialPolicy,
120-
updateMask: "bindings",
116+
.post(`/v1/projects/${PROJECT_ID}:setIamPolicy`, (body: any) => {
117+
return body.updateMask === "bindings" && JSON.stringify(body.policy) === JSON.stringify(initialPolicy);
121118
})
122119
.reply(200, initialPolicy);
123120

0 commit comments

Comments
 (0)