Skip to content

Commit 501543d

Browse files
committed
Test warnings (fix #8)
1 parent f19314e commit 501543d

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
},
3131
"browserslist": "chrome 104",
3232
"jest": {
33+
"restoreMocks": true,
3334
"testPathIgnorePatterns": [
3435
"/fixtures/"
3536
]

src/test.ts

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,55 @@ const extension = new Extension()
1414
const selectors: Selector[] = [["aria/Test"], ["#test"]]
1515

1616
describe("Extension", () => {
17-
test("stringify", async () => {
18-
expect(await stringify(flow as UserFlow, { extension })).toBe(
19-
await readFile(join(__dirname, "fixtures/example.test.js"), "utf8"),
20-
)
17+
describe("stringify", () => {
18+
test("fixture", async () => {
19+
expect(await stringify(flow as UserFlow, { extension })).toBe(
20+
await readFile(join(__dirname, "fixtures/example.test.js"), "utf8"),
21+
)
22+
})
23+
24+
test("multiple navigate steps", async () => {
25+
const mock = jest.spyOn(console, "log").mockImplementation()
26+
await stringify(
27+
{
28+
title: "Example",
29+
steps: [
30+
{
31+
type: "navigate",
32+
url: "https://example.com/",
33+
},
34+
{
35+
type: "navigate",
36+
url: "https://example.com/",
37+
},
38+
],
39+
},
40+
{ extension },
41+
)
42+
expect(mock).toHaveBeenCalledWith(
43+
"Warning: Testing Library does not currently handle more than one navigation step per test.",
44+
)
45+
})
46+
47+
test("unsupported", async () => {
48+
const mock = jest.spyOn(console, "log").mockImplementation()
49+
await stringify(
50+
{
51+
title: "Example",
52+
steps: [
53+
{
54+
type: "customStep",
55+
name: "step",
56+
parameters: {},
57+
},
58+
],
59+
},
60+
{ extension },
61+
)
62+
expect(mock).toHaveBeenCalledWith(
63+
"Warning: Testing Library does not currently handle migrating steps of type: customStep. Please check the output to see how this might affect your test.",
64+
)
65+
})
2166
})
2267

2368
describe("stringifyStep", () => {

0 commit comments

Comments
 (0)