summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts
diff options
context:
space:
mode:
authorzyoshoka <107108195+zyoshoka@users.noreply.github.com>2024-06-08 18:00:54 +0900
committerGitHub <noreply@github.com>2024-06-08 18:00:54 +0900
commit9849aab40283cbde2184e74d4795aec8ef8ccba3 (patch)
tree913efa935d00b01f9936794e74e410283ba1dbc5 /packages/frontend/src/scripts
parentfeat: 通報を受けた際にメールまたはWebhookで通知を送出出... (diff)
downloadsharkey-9849aab40283cbde2184e74d4795aec8ef8ccba3.tar.gz
sharkey-9849aab40283cbde2184e74d4795aec8ef8ccba3.tar.bz2
sharkey-9849aab40283cbde2184e74d4795aec8ef8ccba3.zip
test(#10336): add `components/MkC.*` stories (#13830)
* test(storybook): add `components/MkC.*` stories * test(storybook): add some tests * test: add sleep * test: comment-out flaky test * test(storybook): add test for `MkChannelFollowButton` * chore(storybook): tweak sleep duration in `MkChannelFollowButton` story test * fix(chromatic): add delay to `MkChannelList` * chore: replace `mswDecorator` with `mswLoader` * fix(storybook): tweak some parameters * chore: serve static files * fix(chromatic): add delay to `MkCwButton` * chore: delete logging for debug * fix: add right click in `MkContextMenu` play * refactor: remove unused imports
Diffstat (limited to 'packages/frontend/src/scripts')
-rw-r--r--packages/frontend/src/scripts/test-utils.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/frontend/src/scripts/test-utils.ts b/packages/frontend/src/scripts/test-utils.ts
index 52bb2d94e0..a32315f4df 100644
--- a/packages/frontend/src/scripts/test-utils.ts
+++ b/packages/frontend/src/scripts/test-utils.ts
@@ -7,3 +7,13 @@ export async function tick(): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
await new Promise((globalThis.requestIdleCallback ?? setTimeout) as never);
}
+
+/**
+ * @see https://github.com/misskey-dev/misskey/issues/11267
+ */
+export function semaphore(counter = 0, waiting: (() => void)[] = []) {
+ return {
+ acquire: () => ++counter > 1 && new Promise<void>(resolve => waiting.push(resolve)),
+ release: () => --counter && waiting.pop()?.(),
+ };
+}