Skip to content

Commit

Permalink
test: adjust timeout values
Browse files Browse the repository at this point in the history
  • Loading branch information
KnorpelSenf committed Oct 31, 2024
1 parent 224ca3b commit 6ac8481
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions test/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,7 @@ describe("createConversation", () => {
i++;
await convo.wait();
j++;
}, {
id: "convo",
maxMillisecondsToWait: 10,
}),
}, { id: "convo", maxMillisecondsToWait: 1 }),
async (ctx) => {
if (!enter) return;
enter = false;
Expand All @@ -276,7 +273,7 @@ describe("createConversation", () => {
);
const up = { message: { chat: { id: 0 } } };
await mw.middleware()(mkctx(up), next);
await new Promise((r) => setTimeout(r, 20));
await new Promise((r) => setTimeout(r, 5));
await mw.middleware()(mkctx(up), next);
assertEquals(i, 2);
assertEquals(j, 0);
Expand All @@ -295,10 +292,7 @@ describe("createConversation", () => {
i++;
await convo.wait();
j++;
}, {
id: "convo",
maxMillisecondsToWait: 20,
}),
}, { id: "convo", maxMillisecondsToWait: 100 }),
async (ctx) => {
if (!enter) return;
enter = false;
Expand All @@ -307,7 +301,7 @@ describe("createConversation", () => {
);
const up = { message: { chat: { id: 0 } } };
await mw.middleware()(mkctx(up), next);
await new Promise((r) => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 5));
await mw.middleware()(mkctx(up), next);
assertEquals(i, 2);
assertEquals(j, 1);
Expand All @@ -322,7 +316,7 @@ describe("createConversation", () => {
conversations({ onExit }),
createConversation(async (convo) => {
i++;
await convo.wait({ maxMilliseconds: 10 });
await convo.wait({ maxMilliseconds: 1 });
j++;
}, "convo"),
async (ctx) => {
Expand All @@ -333,7 +327,7 @@ describe("createConversation", () => {
);
const up = { message: { chat: { id: 0 } } };
await mw.middleware()(mkctx(up), next);
await new Promise((r) => setTimeout(r, 20));
await new Promise((r) => setTimeout(r, 5));
await mw.middleware()(mkctx(up), next);
assertEquals(i, 2);
assertEquals(j, 0);
Expand All @@ -350,7 +344,7 @@ describe("createConversation", () => {
conversations({ onExit }),
createConversation(async (convo) => {
i++;
await convo.wait({ maxMilliseconds: 20 });
await convo.wait({ maxMilliseconds: 100 });
j++;
}, "convo"),
async (ctx) => {
Expand All @@ -361,7 +355,7 @@ describe("createConversation", () => {
);
const up = { message: { chat: { id: 0 } } };
await mw.middleware()(mkctx(up), next);
await new Promise((r) => setTimeout(r, 10));
await new Promise((r) => setTimeout(r, 5));
await mw.middleware()(mkctx(up), next);
assertEquals(i, 2);
assertEquals(j, 1);
Expand Down

0 comments on commit 6ac8481

Please sign in to comment.