Skip to content

Commit d9dbbf2

Browse files
committed
tests: Switch from medium to p-fifo.
Signed-off-by: Anders Kaseorg <[email protected]>
1 parent a9c9de2 commit d9dbbf2

File tree

5 files changed

+39
-28
lines changed

5 files changed

+39
-28
lines changed

package-lock.json

Lines changed: 22 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@
179179
"htmlhint": "^1.1.2",
180180
"i18n": "^0.15.1",
181181
"i18next-parser": "^9.3.0",
182-
"medium": "^1.2.0",
183182
"node-json-db": "^1.3.0",
183+
"p-fifo": "^1.0.0",
184184
"playwright-core": "^1.41.0-alpha-jan-9-2024",
185185
"pre-commit": "^1.2.2",
186186
"prettier": "^3.0.3",

tests/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {chan, put, take} from "medium";
1+
import Fifo from "p-fifo";
22
import test from "tape";
33

44
import * as setup from "./setup.js";
@@ -8,11 +8,11 @@ test("app runs", async (t) => {
88
setup.resetTestDataDirectory();
99
const app = await setup.createApp();
1010
try {
11-
const windows = chan();
12-
for (const win of app.windows()) put(windows, win);
13-
app.on("window", (win) => put(windows, win));
11+
const windows = new Fifo();
12+
for (const win of app.windows()) windows.push(win);
13+
app.on("window", (win) => windows.push(win));
1414

15-
const mainWindow = await take(windows);
15+
const mainWindow = await windows.shift();
1616
t.equal(await mainWindow.title(), "Zulip");
1717

1818
await mainWindow.waitForSelector("#connect");

tests/test-add-organization.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {chan, put, take} from "medium";
1+
import Fifo from "p-fifo";
22
import test from "tape";
33

44
import * as setup from "./setup.js";
@@ -8,11 +8,11 @@ test("add-organization", async (t) => {
88
setup.resetTestDataDirectory();
99
const app = await setup.createApp();
1010
try {
11-
const windows = chan();
12-
for (const win of app.windows()) put(windows, win);
13-
app.on("window", (win) => put(windows, win));
11+
const windows = new Fifo();
12+
for (const win of app.windows()) windows.push(win);
13+
app.on("window", (win) => windows.push(win));
1414

15-
const mainWindow = await take(windows);
15+
const mainWindow = await windows.shift();
1616
t.equal(await mainWindow.title(), "Zulip");
1717

1818
await mainWindow.fill(
@@ -21,7 +21,7 @@ test("add-organization", async (t) => {
2121
);
2222
await mainWindow.click("#connect");
2323

24-
const orgWebview = await take(windows);
24+
const orgWebview = await windows.shift();
2525
await orgWebview.waitForSelector("#id_username");
2626
} finally {
2727
await setup.endTest(app);

tests/test-new-organization.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {chan, put, take} from "medium";
1+
import Fifo from "p-fifo";
22
import test from "tape";
33

44
import * as setup from "./setup.js";
@@ -10,11 +10,11 @@ test("new-org-link", async (t) => {
1010
setup.resetTestDataDirectory();
1111
const app = await setup.createApp();
1212
try {
13-
const windows = chan();
14-
for (const win of app.windows()) put(windows, win);
15-
app.on("window", (win) => put(windows, win));
13+
const windows = new Fifo();
14+
for (const win of app.windows()) windows.push(win);
15+
app.on("window", (win) => windows.push(win));
1616

17-
const mainWindow = await take(windows);
17+
const mainWindow = await windows.shift();
1818
t.equal(await mainWindow.title(), "Zulip");
1919

2020
await mainWindow.click("#open-create-org-link");

0 commit comments

Comments
 (0)