Skip to content

Commit 05bad89

Browse files
authored
[KeyVault] - Fix integration tests (Azure#13482)
This commit fixes two things that were recently added: - Fix a typo in test expectation - await on `isRejected` to catch when the expectation isn't met
1 parent b56d19e commit 05bad89

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

sdk/keyvault/keyvault-keys/test/public/crypto.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe("CryptographyClient (all decrypts happen remotely)", () => {
135135
const unwrappedResult = await cryptoClient.unwrapKey("RSA-OAEP", wrapped.result);
136136
const unwrappedText = uint8ArrayToString(unwrappedResult.result);
137137
assert.equal(text, unwrappedText);
138-
assert.equal("RSA_OAEP", unwrappedResult.algorithm);
138+
assert.equal("RSA-OAEP", unwrappedResult.algorithm);
139139
});
140140

141141
if (!isPlaybackMode()) {

sdk/keyvault/keyvault-keys/test/public/localCryptography.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ describe("Local cryptography public tests", () => {
6666
const expectedErrorMessage = "Algorithm foo is not supported for a local JsonWebKey.";
6767

6868
it("throws on encrypt", async function() {
69-
assert.isRejected(
69+
await assert.isRejected(
7070
cryptoClientFromKey.encrypt("foo", Buffer.from("bar")),
7171
expectedErrorMessage
7272
);
7373
});
7474

7575
it("throws on wrapKey", async function() {
76-
assert.isRejected(
76+
await assert.isRejected(
7777
cryptoClientFromKey.wrapKey("A128KW", Buffer.from("bar")),
7878
"Algorithm A128KW is not supported for a local JsonWebKey."
7979
);
8080
});
8181

8282
it("throws on verifyData", async function() {
83-
assert.isRejected(
83+
await assert.isRejected(
8484
cryptoClientFromKey.verifyData("foo", Buffer.from("bar"), Buffer.from("baz")),
8585
expectedErrorMessage
8686
);
@@ -89,37 +89,37 @@ describe("Local cryptography public tests", () => {
8989

9090
describe("when using an unsupported operation", function() {
9191
it("throws on decrypt", async function() {
92-
assert.isRejected(
92+
await assert.isRejected(
9393
cryptoClientFromKey.decrypt("RSA1_5", Buffer.from("bar")),
94-
"Decrypting a local JsonWebKey is not supported."
94+
"Decrypting using a local JsonWebKey is not supported."
9595
);
9696
});
9797

9898
it("throws on unwrapKey", async function() {
99-
assert.isRejected(
99+
await assert.isRejected(
100100
cryptoClientFromKey.unwrapKey("RSA1_5", Buffer.from("bar")),
101-
"Unwrapping a local JsonWebKey is not supported."
101+
"Unwrapping a key using a local JsonWebKey is not supported."
102102
);
103103
});
104104

105105
it("throws on sign", async function() {
106-
assert.isRejected(
106+
await assert.isRejected(
107107
cryptoClientFromKey.sign("RSA1_5", Buffer.from("bar")),
108-
"Signing a local JsonWebKey is not supported."
108+
"Signing a digest using a local JsonWebKey is not supported."
109109
);
110110
});
111111

112112
it("throws on verify", async function() {
113-
assert.isRejected(
113+
await assert.isRejected(
114114
cryptoClientFromKey.verify("RSA1_5", Buffer.from("bar"), Buffer.from("baz")),
115-
"Verifying a local JsonWebKey is not supported."
115+
"Verifying a digest using a local JsonWebKey is not supported."
116116
);
117117
});
118118

119119
it("throws on signData", async function() {
120-
assert.isRejected(
120+
await assert.isRejected(
121121
cryptoClientFromKey.signData("RSA1_5", Buffer.from("bar")),
122-
"Signing a local JsonWebKey is not supported."
122+
"Signing data using a local JsonWebKey is not supported."
123123
);
124124
});
125125
});

0 commit comments

Comments
 (0)