Skip to content

Commit 4886c48

Browse files
committed
update per comments
1 parent e01fe8d commit 4886c48

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

packages/examples/packages/notifications/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "jrOzxCG7RKSqVS0TPw4sZiUoB4A00AXqdfkA5iGJ94g=",
10+
"shasum": "DV0AnwJKM1iKxKscfZOjr/y8qAKP0tdp8wU+2PBMxk8=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snaps-jest/src/matchers.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ export const toRespondWithError: MatcherFunction<[expected: Json]> = function (
168168
export const toSendNotification: MatcherFunction<
169169
[
170170
expectedMessage: string,
171-
expectedType: EnumToUnion<NotificationType>,
171+
expectedType?: EnumToUnion<NotificationType>,
172172
expectedTitle?: string | undefined,
173173
expectedContent?: JSXElement | undefined,
174174
expectedFooterLink?: { text: string; href: string } | undefined,
@@ -202,7 +202,7 @@ export const toSendNotification: MatcherFunction<
202202
return false;
203203
}
204204

205-
if (type !== expectedType) {
205+
if (expectedType && type !== expectedType) {
206206
return false;
207207
}
208208

@@ -248,7 +248,11 @@ export const toSendNotification: MatcherFunction<
248248
expectedMessage,
249249
)}\n`;
250250

251-
testMessage += `Expected type: ${this.utils.printExpected(expectedType)}\n`;
251+
if (expectedType) {
252+
testMessage += `Expected type: ${this.utils.printExpected(
253+
expectedType,
254+
)}\n`;
255+
}
252256

253257
if (title) {
254258
testMessage += `Expected title: ${this.utils.printExpected(
@@ -277,7 +281,9 @@ export const toSendNotification: MatcherFunction<
277281
notifMessage,
278282
)}\n`;
279283

280-
testMessage += `Received type: ${this.utils.printReceived(type)}\n`;
284+
if (expectedType) {
285+
testMessage += `Received type: ${this.utils.printReceived(type)}\n`;
286+
}
281287

282288
if (title) {
283289
testMessage += `Received title: ${this.utils.printReceived(title)}\n`;

0 commit comments

Comments
 (0)