ui test cleanups

* update `msw` 0.49 -> 1.x. (2.x is out now, but small steps.)
* wrap some `jest.{runOnlyPendingTimers,advanceTimersByTime}` calls
  in `act`.
* extend a timeout that had no slack at all
This commit is contained in:
Scott Lamb 2023-12-09 14:59:40 -08:00
parent f493ad94eb
commit 3de62eb70d
4 changed files with 110 additions and 93 deletions

186
ui/package-lock.json generated
View File

@ -37,7 +37,7 @@
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.2.5",
"http-proxy-middleware": "^2.0.4",
"msw": "^0.49.2",
"msw": "^1.3.2",
"prettier": "^2.6.0"
}
},
@ -3174,16 +3174,16 @@
}
},
"node_modules/@mswjs/interceptors": {
"version": "0.17.6",
"resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.6.tgz",
"integrity": "sha512-201pBIWehTURb6q8Gheu4Zhvd3Ox1U4BJq5KiOQsYzkWyfiOG4pwcz5hPZIEryztgrf8/sdwABpvY757xMmfrQ==",
"version": "0.17.10",
"resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.10.tgz",
"integrity": "sha512-N8x7eSLGcmUFNWZRxT1vsHvypzIRgQYdG0rJey/rZCy6zT/30qDt8Joj7FxzGNLSwXbeZqJOMqDurp7ra4hgbw==",
"dev": true,
"dependencies": {
"@open-draft/until": "^1.0.3",
"@types/debug": "^4.1.7",
"@xmldom/xmldom": "^0.8.3",
"debug": "^4.3.3",
"headers-polyfill": "^3.1.0",
"headers-polyfill": "3.2.5",
"outvariant": "^1.2.1",
"strict-event-emitter": "^0.2.4",
"web-encoding": "^1.1.5"
@ -3192,6 +3192,15 @@
"node": ">=14"
}
},
"node_modules/@mswjs/interceptors/node_modules/strict-event-emitter": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.8.tgz",
"integrity": "sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A==",
"dev": true,
"dependencies": {
"events": "^3.3.0"
}
},
"node_modules/@mui/base": {
"version": "5.0.0-alpha.113",
"resolved": "https://registry.npmjs.org/@mui/base/-/base-5.0.0-alpha.113.tgz",
@ -4379,9 +4388,9 @@
"dev": true
},
"node_modules/@types/debug": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
"integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
"version": "4.1.12",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
"integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
"dev": true,
"dependencies": {
"@types/ms": "*"
@ -4740,9 +4749,9 @@
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA=="
},
"node_modules/@types/ms": {
"version": "0.7.31",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==",
"version": "0.7.34",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
"integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==",
"dev": true
},
"node_modules/@types/node": {
@ -5342,9 +5351,9 @@
}
},
"node_modules/@xmldom/xmldom": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.6.tgz",
"integrity": "sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==",
"version": "0.8.10",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
"dev": true,
"engines": {
"node": ">=10.0.0"
@ -9651,9 +9660,9 @@
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ=="
},
"node_modules/graphql": {
"version": "16.6.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz",
"integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==",
"version": "16.8.1",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz",
"integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
@ -9784,9 +9793,9 @@
}
},
"node_modules/headers-polyfill": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.1.2.tgz",
"integrity": "sha512-tWCK4biJ6hcLqTviLXVR9DTRfYGQMXEIUj3gwJ2rZ5wO/at3XtkI4g8mCvFdUF9l1KMBNCfmNAdnahm1cgavQA==",
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.2.5.tgz",
"integrity": "sha512-tUCGvt191vNSQgttSyJoibR+VO+I6+iCHIUdhzEMJKE+EAL8BwCN7fUOZlY4ofOelNHsK+gEjxB/B+9N3EWtdA==",
"dev": true
},
"node_modules/hoist-non-react-statics": {
@ -10501,9 +10510,9 @@
}
},
"node_modules/is-node-process": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.0.1.tgz",
"integrity": "sha512-5IcdXuf++TTNt3oGl9EBdkvndXA8gmc4bz/Y+mdEpWh3Mcn/+kOw6hI7LD5CocqJWMzeb0I0ClndRVNdEPuJXQ==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz",
"integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==",
"dev": true
},
"node_modules/is-number": {
@ -13528,29 +13537,29 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/msw": {
"version": "0.49.2",
"resolved": "https://registry.npmjs.org/msw/-/msw-0.49.2.tgz",
"integrity": "sha512-70/E10f+POE2UmMw16v8PnKatpZplpkUwVRLBqiIdimpgaC3le7y2yOq9JmOrL15jpwWM5wAcPTOj0f550LI3g==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/msw/-/msw-1.3.2.tgz",
"integrity": "sha512-wKLhFPR+NitYTkQl5047pia0reNGgf0P6a1eTnA5aNlripmiz0sabMvvHcicE8kQ3/gZcI0YiPFWmYfowfm3lA==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
"@mswjs/cookies": "^0.2.2",
"@mswjs/interceptors": "^0.17.5",
"@mswjs/interceptors": "^0.17.10",
"@open-draft/until": "^1.0.3",
"@types/cookie": "^0.4.1",
"@types/js-levenshtein": "^1.1.1",
"chalk": "4.1.1",
"chalk": "^4.1.1",
"chokidar": "^3.4.2",
"cookie": "^0.4.2",
"graphql": "^15.0.0 || ^16.0.0",
"headers-polyfill": "^3.1.0",
"graphql": "^16.8.1",
"headers-polyfill": "3.2.5",
"inquirer": "^8.2.0",
"is-node-process": "^1.0.1",
"is-node-process": "^1.2.0",
"js-levenshtein": "^1.1.6",
"node-fetch": "^2.6.7",
"outvariant": "^1.3.0",
"outvariant": "^1.4.0",
"path-to-regexp": "^6.2.0",
"strict-event-emitter": "^0.2.6",
"strict-event-emitter": "^0.4.3",
"type-fest": "^2.19.0",
"yargs": "^17.3.1"
},
@ -13565,7 +13574,7 @@
"url": "https://opencollective.com/mswjs"
},
"peerDependencies": {
"typescript": ">= 4.4.x <= 4.9.x"
"typescript": ">= 4.4.x <= 5.2.x"
},
"peerDependenciesMeta": {
"typescript": {
@ -14114,9 +14123,9 @@
}
},
"node_modules/outvariant": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.3.0.tgz",
"integrity": "sha512-yeWM9k6UPfG/nzxdaPlJkB2p08hCg4xP6Lx99F+vP8YF7xyZVfTmJjrrNalkmzudD4WFvNLVudQikqUmF8zhVQ==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.0.tgz",
"integrity": "sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==",
"dev": true
},
"node_modules/p-limit": {
@ -17261,13 +17270,10 @@
"integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ=="
},
"node_modules/strict-event-emitter": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.8.tgz",
"integrity": "sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A==",
"dev": true,
"dependencies": {
"events": "^3.3.0"
}
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz",
"integrity": "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==",
"dev": true
},
"node_modules/string_decoder": {
"version": "1.3.0",
@ -21358,19 +21364,30 @@
}
},
"@mswjs/interceptors": {
"version": "0.17.6",
"resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.6.tgz",
"integrity": "sha512-201pBIWehTURb6q8Gheu4Zhvd3Ox1U4BJq5KiOQsYzkWyfiOG4pwcz5hPZIEryztgrf8/sdwABpvY757xMmfrQ==",
"version": "0.17.10",
"resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.10.tgz",
"integrity": "sha512-N8x7eSLGcmUFNWZRxT1vsHvypzIRgQYdG0rJey/rZCy6zT/30qDt8Joj7FxzGNLSwXbeZqJOMqDurp7ra4hgbw==",
"dev": true,
"requires": {
"@open-draft/until": "^1.0.3",
"@types/debug": "^4.1.7",
"@xmldom/xmldom": "^0.8.3",
"debug": "^4.3.3",
"headers-polyfill": "^3.1.0",
"headers-polyfill": "3.2.5",
"outvariant": "^1.2.1",
"strict-event-emitter": "^0.2.4",
"web-encoding": "^1.1.5"
},
"dependencies": {
"strict-event-emitter": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.8.tgz",
"integrity": "sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A==",
"dev": true,
"requires": {
"events": "^3.3.0"
}
}
}
},
"@mui/base": {
@ -22072,9 +22089,9 @@
"dev": true
},
"@types/debug": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.7.tgz",
"integrity": "sha512-9AonUzyTjXXhEOa0DnqpzZi6VHlqKMswga9EXjpXnnqxwLtdvPPtlO8evrI5D9S6asFRCQ6v+wpiUKbw+vKqyg==",
"version": "4.1.12",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
"integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
"dev": true,
"requires": {
"@types/ms": "*"
@ -22380,9 +22397,9 @@
"integrity": "sha512-Y4XFY5VJAuw0FgAqPNd6NNoV44jbq9Bz2L7Rh/J6jLTiHBSBJa9fxqQIvkIld4GsoDOcCbvzOUAbLPsSKKg+uA=="
},
"@types/ms": {
"version": "0.7.31",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.31.tgz",
"integrity": "sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA==",
"version": "0.7.34",
"resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
"integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==",
"dev": true
},
"@types/node": {
@ -22856,9 +22873,9 @@
}
},
"@xmldom/xmldom": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.6.tgz",
"integrity": "sha512-uRjjusqpoqfmRkTaNuLJ2VohVr67Q5YwDATW3VU7PfzTj6IRaihGrYI7zckGZjxQPBIp63nfvJbM+Yu5ICh0Bg==",
"version": "0.8.10",
"resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
"integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
"dev": true
},
"@xtuc/ieee754": {
@ -25996,9 +26013,9 @@
"integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ=="
},
"graphql": {
"version": "16.6.0",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.6.0.tgz",
"integrity": "sha512-KPIBPDlW7NxrbT/eh4qPXz5FiFdL5UbaA0XUNz2Rp3Z3hqBSkbj0GVjwFDztsWVauZUWsbKHgMg++sk8UX0bkw==",
"version": "16.8.1",
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz",
"integrity": "sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==",
"dev": true
},
"gzip-size": {
@ -26081,9 +26098,9 @@
"integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw=="
},
"headers-polyfill": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.1.2.tgz",
"integrity": "sha512-tWCK4biJ6hcLqTviLXVR9DTRfYGQMXEIUj3gwJ2rZ5wO/at3XtkI4g8mCvFdUF9l1KMBNCfmNAdnahm1cgavQA==",
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.2.5.tgz",
"integrity": "sha512-tUCGvt191vNSQgttSyJoibR+VO+I6+iCHIUdhzEMJKE+EAL8BwCN7fUOZlY4ofOelNHsK+gEjxB/B+9N3EWtdA==",
"dev": true
},
"hoist-non-react-statics": {
@ -26590,9 +26607,9 @@
"integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA=="
},
"is-node-process": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.0.1.tgz",
"integrity": "sha512-5IcdXuf++TTNt3oGl9EBdkvndXA8gmc4bz/Y+mdEpWh3Mcn/+kOw6hI7LD5CocqJWMzeb0I0ClndRVNdEPuJXQ==",
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-node-process/-/is-node-process-1.2.0.tgz",
"integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==",
"dev": true
},
"is-number": {
@ -28794,28 +28811,28 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"msw": {
"version": "0.49.2",
"resolved": "https://registry.npmjs.org/msw/-/msw-0.49.2.tgz",
"integrity": "sha512-70/E10f+POE2UmMw16v8PnKatpZplpkUwVRLBqiIdimpgaC3le7y2yOq9JmOrL15jpwWM5wAcPTOj0f550LI3g==",
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/msw/-/msw-1.3.2.tgz",
"integrity": "sha512-wKLhFPR+NitYTkQl5047pia0reNGgf0P6a1eTnA5aNlripmiz0sabMvvHcicE8kQ3/gZcI0YiPFWmYfowfm3lA==",
"dev": true,
"requires": {
"@mswjs/cookies": "^0.2.2",
"@mswjs/interceptors": "^0.17.5",
"@mswjs/interceptors": "^0.17.10",
"@open-draft/until": "^1.0.3",
"@types/cookie": "^0.4.1",
"@types/js-levenshtein": "^1.1.1",
"chalk": "4.1.1",
"chalk": "^4.1.1",
"chokidar": "^3.4.2",
"cookie": "^0.4.2",
"graphql": "^15.0.0 || ^16.0.0",
"headers-polyfill": "^3.1.0",
"graphql": "^16.8.1",
"headers-polyfill": "3.2.5",
"inquirer": "^8.2.0",
"is-node-process": "^1.0.1",
"is-node-process": "^1.2.0",
"js-levenshtein": "^1.1.6",
"node-fetch": "^2.6.7",
"outvariant": "^1.3.0",
"outvariant": "^1.4.0",
"path-to-regexp": "^6.2.0",
"strict-event-emitter": "^0.2.6",
"strict-event-emitter": "^0.4.3",
"type-fest": "^2.19.0",
"yargs": "^17.3.1"
},
@ -29201,9 +29218,9 @@
"integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g=="
},
"outvariant": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.3.0.tgz",
"integrity": "sha512-yeWM9k6UPfG/nzxdaPlJkB2p08hCg4xP6Lx99F+vP8YF7xyZVfTmJjrrNalkmzudD4WFvNLVudQikqUmF8zhVQ==",
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.0.tgz",
"integrity": "sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==",
"dev": true
},
"p-limit": {
@ -31320,13 +31337,10 @@
"integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ=="
},
"strict-event-emitter": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.8.tgz",
"integrity": "sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A==",
"dev": true,
"requires": {
"events": "^3.3.0"
}
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz",
"integrity": "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==",
"dev": true
},
"string_decoder": {
"version": "1.3.0",

View File

@ -72,7 +72,7 @@
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.2.5",
"http-proxy-middleware": "^2.0.4",
"msw": "^0.49.2",
"msw": "^1.3.2",
"prettier": "^2.6.0"
}
}

View File

@ -162,7 +162,10 @@ test("slow replace", async () => {
expect(screen.getByText(/26 Apr 2021 08:21:13/)).toBeInTheDocument();
// A loading indicator should show up after a second.
expect(await screen.findByRole("progressbar")).toBeInTheDocument();
// The default timeout is 1 second; extend it to pass reliably.
expect(
await screen.findByRole("progressbar", {}, { timeout: 2000 })
).toBeInTheDocument();
// Then the second query result should show up.
expect(await screen.findByText(/27 Apr 2021 06:17:43/)).toBeInTheDocument();

View File

@ -2,7 +2,7 @@
// Copyright (C) 2021 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception
import { render, screen, waitFor } from "@testing-library/react";
import { act, render, screen, waitFor } from "@testing-library/react";
import { useEffect } from "react";
import { SnackbarProvider, useSnackbars } from "./snackbars";
@ -34,24 +34,24 @@ test("notifications that time out", async () => {
expect(screen.queryByText(/message B/)).not.toBeInTheDocument();
// ...then start to close...
jest.advanceTimersByTime(5000);
act(() => jest.advanceTimersByTime(5000));
expect(screen.getByText(/message A/)).toBeInTheDocument();
expect(screen.queryByText(/message B/)).not.toBeInTheDocument();
// ...then it should close and message B should open...
jest.runOnlyPendingTimers();
act(() => jest.runOnlyPendingTimers());
await waitFor(() =>
expect(screen.queryByText(/message A/)).not.toBeInTheDocument()
);
expect(screen.getByText(/message B/)).toBeInTheDocument();
// ...then message B should start to close...
jest.advanceTimersByTime(5000);
act(() => jest.advanceTimersByTime(5000));
expect(screen.queryByText(/message A/)).not.toBeInTheDocument();
expect(screen.getByText(/message B/)).toBeInTheDocument();
// ...then message B should fully close.
jest.runOnlyPendingTimers();
act(() => jest.runOnlyPendingTimers());
expect(screen.queryByText(/message A/)).not.toBeInTheDocument();
await waitFor(() =>
expect(screen.queryByText(/message B/)).not.toBeInTheDocument()