|
|
@@ -4,9 +4,9 @@ vi.stubGlobal('MathMLElement', class MathMLElement {})
|
|
|
|
|
|
expect.extend({
|
|
|
toHaveBeenWarned(received: string) {
|
|
|
- asserted.add(received)
|
|
|
const passed = warn.mock.calls.some(args => args[0].includes(received))
|
|
|
if (passed) {
|
|
|
+ asserted.add(received)
|
|
|
return {
|
|
|
pass: true,
|
|
|
message: () => `expected "${received}" not to have been warned.`,
|
|
|
@@ -25,10 +25,10 @@ expect.extend({
|
|
|
},
|
|
|
|
|
|
toHaveBeenWarnedLast(received: string) {
|
|
|
- asserted.add(received)
|
|
|
const passed =
|
|
|
warn.mock.calls[warn.mock.calls.length - 1][0].includes(received)
|
|
|
if (passed) {
|
|
|
+ asserted.add(received)
|
|
|
return {
|
|
|
pass: true,
|
|
|
message: () => `expected "${received}" not to have been warned last.`,
|
|
|
@@ -44,7 +44,6 @@ expect.extend({
|
|
|
},
|
|
|
|
|
|
toHaveBeenWarnedTimes(received: string, n: number) {
|
|
|
- asserted.add(received)
|
|
|
let found = 0
|
|
|
warn.mock.calls.forEach(args => {
|
|
|
if (args[0].includes(received)) {
|
|
|
@@ -53,6 +52,7 @@ expect.extend({
|
|
|
})
|
|
|
|
|
|
if (found === n) {
|
|
|
+ asserted.add(received)
|
|
|
return {
|
|
|
pass: true,
|
|
|
message: () => `expected "${received}" to have been warned ${n} times.`,
|