Skip to content

Commit c40e795

Browse files
authored
fix: url command assertion message (#38)
* fix: url command assertion message * fix: remove trailing line
1 parent c326810 commit c40e795

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

examples/my-twd-app/src/twd-tests/app.twd.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ describe("App interactions", () => {
9898
await user.click(submitBtn.el);
9999
const rule = await twd.waitForRequest("contactSubmit");
100100
console.log(`Submitted body: ${rule.request}`);
101+
twd.url().should("contain.url", "/contact");
101102
twd.clearRequestMockRules();
102103
});
103104
});

src/commands/url.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { log } from "../utils/log";
12
import { assertionMessage } from "../utils/assertionMessage";
23
/**
34
* All supported assertion names for the `should` function in url command
@@ -64,7 +65,11 @@ const should = (name: AnyURLAssertion, value: string) => {
6465
const urlCommand = (): URLCommandAPI => {
6566
return {
6667
location: window.location,
67-
should,
68+
should: (name: AnyURLAssertion, value: string) => {
69+
const result = should(name, value);
70+
log(result);
71+
return result;
72+
},
6873
};
6974
};
7075

src/tests/e2e/api/get.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { beforeEach, describe, expect, it, vi } from 'vitest';
1+
import { beforeEach, describe, expect, it } from 'vitest';
22
import { twd } from '../../..';
33

44
describe('twd get command', () => {

0 commit comments

Comments
 (0)