Skip to content

Commit 1bf656a

Browse files
committed
fix typo and add assertion message
1 parent edd19b7 commit 1bf656a

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

v-next/core/src/internal/async-mutex.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class AsyncMutex {
1515
* @param f The function to run.
1616
* @returns The result of the function.
1717
*/
18-
public async excluiveRun<ReturnT>(
18+
public async exclusiveRun<ReturnT>(
1919
f: () => ReturnT,
2020
): Promise<Awaited<ReturnT>> {
2121
const release = await this.#acquire();

v-next/core/src/internal/user-interruptions.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class UserInterruptionManagerImplementation
1717
interruptor: string,
1818
message: string,
1919
): Promise<void> {
20-
return this.#mutex.excluiveRun(async () => {
20+
return this.#mutex.exclusiveRun(async () => {
2121
return this.#hooks.runHandlerChain(
2222
"userInterruptions",
2323
"displayMessage",
@@ -31,7 +31,7 @@ export class UserInterruptionManagerImplementation
3131
interruptor: string,
3232
inputDescription: string,
3333
): Promise<string> {
34-
return this.#mutex.excluiveRun(async () => {
34+
return this.#mutex.exclusiveRun(async () => {
3535
return this.#hooks.runHandlerChain(
3636
"userInterruptions",
3737
"requestInput",
@@ -45,7 +45,7 @@ export class UserInterruptionManagerImplementation
4545
interruptor: string,
4646
inputDescription: string,
4747
): Promise<string> {
48-
return this.#mutex.excluiveRun(async () => {
48+
return this.#mutex.exclusiveRun(async () => {
4949
return this.#hooks.runHandlerChain(
5050
"userInterruptions",
5151
"requestSecretInput",
@@ -58,7 +58,7 @@ export class UserInterruptionManagerImplementation
5858
public async uninterrupted<ReturnT>(
5959
f: () => ReturnT,
6060
): Promise<Awaited<ReturnT>> {
61-
return this.#mutex.excluiveRun(f);
61+
return this.#mutex.exclusiveRun(f);
6262
}
6363
}
6464

v-next/core/test/internal/user-interruptions/async-mutex.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ describe("AsyncMutex", () => {
1818
}
1919

2020
await Promise.all([
21-
mutex.excluiveRun(run),
22-
mutex.excluiveRun(run),
23-
mutex.excluiveRun(run),
21+
mutex.exclusiveRun(run),
22+
mutex.exclusiveRun(run),
23+
mutex.exclusiveRun(run),
2424
]);
2525

26-
assert.strictEqual(maxRunning, 1);
26+
assert.equal(maxRunning, 1);
27+
assert.equal(running, 0);
2728
});
2829
});

v-next/core/test/internal/user-interruptions/user-interruptions-manager.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ describe("UserInterruptionManager", () => {
3333
"test-message",
3434
);
3535

36-
assert(called);
36+
assert(called, "Handler was not called");
3737
assert.equal(givenInterruptor, "test-interruptor");
3838
assert.equal(givenMessage, "test-message");
3939
});
@@ -67,7 +67,7 @@ describe("UserInterruptionManager", () => {
6767
"test-input-description",
6868
);
6969

70-
assert(called);
70+
assert(called, "Handler was not called");
7171
assert.equal(givenInterruptor, "test-interruptor");
7272
assert.equal(givenInputDescription, "test-input-description");
7373
assert.equal(input, "test-input");
@@ -102,7 +102,7 @@ describe("UserInterruptionManager", () => {
102102
"test-input-description",
103103
);
104104

105-
assert(called);
105+
assert(called, "Handler was not called");
106106
assert.equal(givenInterruptor, "test-interruptor");
107107
assert.equal(givenInputDescription, "test-input-description");
108108
assert.equal(input, "test-secret-input");

0 commit comments

Comments
 (0)