feat: update vitest version v0.34 to V2.11 (#16676)
* update version * fix button to match new spec * migrate tests to objectContaining * fix tests * update RTL * yarn.lock update * bump fetch mock to latest vitest version * update deep mock to use vitest 2.0 * fix mock prisma type cast * meet base test fn singature for V2 * remove console.log from next test
This commit is contained in:
1 parent
562309d24b
commit
e7415fe6e2
15 files changed
+1253
-7457
No files matched your search
@@ -80,7 +80,7 @@ describe("next.config.js - Org Rewrite", () => {
|
||||
|
||||
describe("Rewrite", () => {
|
||||
it("booking pages", () => {
|
||||
expect(orgUserTypeRouteMatch("/user/type")?.params).toContain({
|
||||
expect(orgUserTypeRouteMatch("/user/type")?.params).toEqual({
|
||||
user: "user",
|
||||
type: "type",
|
||||
});
|
||||
@@ -96,27 +96,27 @@ describe("next.config.js - Org Rewrite", () => {
|
||||
|
||||
expect(orgUserTypeRouteMatch("/abc")).toEqual(false);
|
||||
|
||||
expect(orgUserRouteMatch("/abc")?.params).toContain({
|
||||
expect(orgUserRouteMatch("/abc")?.params).toEqual({
|
||||
user: "abc",
|
||||
});
|
||||
|
||||
// Tests that something that starts with 'd' which could accidentally match /d route is correctly identified as a booking page
|
||||
expect(orgUserRouteMatch("/designer")?.params).toContain({
|
||||
expect(orgUserRouteMatch("/designer")?.params).toEqual({
|
||||
user: "designer",
|
||||
});
|
||||
|
||||
// Tests that something that starts with 'apps' which could accidentally match /apps route is correctly identified as a booking page
|
||||
expect(orgUserRouteMatch("/apps-conflict-possibility")?.params).toContain({
|
||||
expect(orgUserRouteMatch("/apps-conflict-possibility")?.params).toEqual({
|
||||
user: "apps-conflict-possibility",
|
||||
});
|
||||
|
||||
// Tests that something that starts with '_next' which could accidentally match /_next route is correctly identified as a booking page
|
||||
expect(orgUserRouteMatch("/_next-candidate")?.params).toContain({
|
||||
expect(orgUserRouteMatch("/_next-candidate")?.params).toEqual({
|
||||
user: "_next-candidate",
|
||||
});
|
||||
|
||||
// Tests that something that starts with 'public' which could accidentally match /public route is correctly identified as a booking page
|
||||
expect(orgUserRouteMatch("/public-person")?.params).toContain({
|
||||
expect(orgUserRouteMatch("/public-person")?.params).toEqual({
|
||||
user: "public-person",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1298,10 +1298,10 @@ export function enableEmailFeature() {
|
||||
|
||||
export function mockNoTranslations() {
|
||||
log.silly("Mocking i18n.getTranslation to return identity function");
|
||||
// @ts-expect-error FIXME
|
||||
i18nMock.getTranslation.mockImplementation(() => {
|
||||
return new Promise((resolve) => {
|
||||
const identityFn = (key: string) => key;
|
||||
// @ts-expect-error FIXME
|
||||
resolve(identityFn);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -16,14 +16,13 @@ const _testWithAndWithoutOrg = (
|
||||
const t = mode === "only" ? test.only : mode === "skip" ? test.skip : test;
|
||||
t(
|
||||
`${description} - With org`,
|
||||
async ({ emails, sms, meta, task, onTestFailed, expect, skip }) => {
|
||||
async ({ emails, sms, task, onTestFailed, expect, skip, onTestFinished }) => {
|
||||
const org = await createOrganization({
|
||||
name: "Test Org",
|
||||
slug: "testorg",
|
||||
});
|
||||
|
||||
await fn({
|
||||
meta,
|
||||
task,
|
||||
onTestFailed,
|
||||
expect,
|
||||
@@ -34,6 +33,7 @@ const _testWithAndWithoutOrg = (
|
||||
organization: org,
|
||||
urlOrigin: `${WEBSITE_PROTOCOL}//${org.slug}.cal.local:3000`,
|
||||
},
|
||||
onTestFinished,
|
||||
});
|
||||
},
|
||||
timeout
|
||||
@@ -41,16 +41,16 @@ const _testWithAndWithoutOrg = (
|
||||
|
||||
t(
|
||||
`${description}`,
|
||||
async ({ emails, sms, meta, task, onTestFailed, expect, skip }) => {
|
||||
async ({ emails, sms, task, onTestFailed, expect, skip, onTestFinished }) => {
|
||||
await fn({
|
||||
emails,
|
||||
sms,
|
||||
meta,
|
||||
task,
|
||||
onTestFailed,
|
||||
expect,
|
||||
skip,
|
||||
org: null,
|
||||
onTestFinished,
|
||||
});
|
||||
},
|
||||
timeout
|
||||
|
||||
Reference in new issue
Block a user