8000 build(deps): bump jest to 30 and keep BlockSuite on 0.19 by adeelahmad · Pull Request #241 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ updates:
groups:
javascript-minor:
update-types: [minor, patch]
ignore:
# BlockSuite after 0.19 is published as raw TypeScript (exports point at src/*.ts) and drops the editor
# presets, so it only builds inside AFFiNE's own repo. The notes editor stays on 0.19.5 until that changes.
- dependency-name: "@blocksuite/*"

- package-ecosystem: github-actions
directory: /
Expand Down
14 changes: 5 additions & 9 deletions nextjs-frontend/__tests__/externalSignIn.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ExternalSignIn } from "@/components/auth/external-sign-in";
import { ExternalSigninReturn, safeNext } from "@/components/auth/external-signin-return";
import { finishSignIn } from "@/components/auth/passkey-flows";
import { LoginForm } from "@/components/auth/login-form";
import { navigate } from "@/lib/navigate";

jest.mock("@/components/actions/login-action", () => ({ login: jest.fn() }));
jest.mock("@/components/auth/passkey-flows", () => ({ passkeyTicket: jest.fn(), finishSignIn: jest.fn() }));
Expand All @@ -18,18 +19,13 @@ jest.mock("@/lib/auth/webauthn", () => ({
const GOOGLE = { key: "google", kind: "google" as const, label: "Google" };
const GITHUB = { key: "github", kind: "github" as const, label: "GitHub" };

const assign = jest.fn();
const replace = jest.fn();
beforeAll(() => {
Object.defineProperty(window, "location", {
configurable: true,
value: { ...window.location, assign, replace, hash: "", pathname: "/external-signin", hostname: "localhost" },
});
});
jest.mock("@/lib/navigate", () => ({ navigate: { assign: jest.fn(), replace: jest.fn() } }));

const { assign, replace } = navigate as jest.Mocked<typeof navigate>;
afterEach(() => jest.clearAllMocks());

function at(hash: string) {
(window.location as { hash: string }).hash = hash;
window.history.replaceState(null, "", `/external-signin${hash}`);
}

describe("signing in with an outside account", () => {
Expand Down
3 changes: 2 additions & 1 deletion nextjs-frontend/components/auth/external-sign-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AuthAlert } from "@/components/auth/auth-card";
import { Button } from "@/components/ui/button";
import { getErrorMessage } from "@/lib/api/client";
import { anonymousClient } from "@/lib/auth/webauthn";
import { navigate } from "@/lib/navigate";

/** The provider's sign-in page for this browser (with the cookie that ties the round trip to it). */
export async function externalSignInUrl(key: string, next: string): Promise<string> {
Expand Down Expand Up @@ -36,7 +37,7 @@ export function ExternalSignIn({
setBusy(key);
setError(null);
try {
window.location.assign(await externalSignInUrl(key, callbackUrl));
navigate.assign(await externalSignInUrl(key, callbackUrl));
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
setBusy(null);
Expand Down
3 changes: 2 additions & 1 deletion nextjs-frontend/components/auth/external-signin-return.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { useEffect, useState } from "react";
import { AuthAlert, AuthCard } from "@/components/auth/auth-card";
import { finishSignIn } from "@/components/auth/passkey-flows";
import { safeCallbackUrl } from "@/lib/definitions";
import { navigate } from "@/lib/navigate";

/** A page of this site to go to next (never another site). */
export function safeNext(next: string | null | undefined, fallback = "/"): string {
Expand Down Expand Up @@ -39,7 +40,7 @@ export function ExternalSigninReturn() {
return;
}
if (got.get("connected")) {
window.location.replace(`${safeNext(next, "/account")}?connected=${encodeURIComponent(got.get("connected")!)}`);
navigate.replace(`${safeNext(next, "/account")}?connected=${encodeURIComponent(got.get("connected")!)}`);
return;
}
setBack(safeNext(next, "/login"));
Expand Down
6 changes: 6 additions & 0 deletions nextjs-frontend/lib/navigate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/** Leaving for another page with a full load, in a module of its own so tests can stand in for it (jsdom's
* window.location can't be replaced). */
export const navigate = {
assign: (url: string) => window.location.assign(url),
replace: (url: string) => window.location.replace(url),
};
6 changes: 3 additions & 3 deletions nextjs-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"@next/eslint-plugin-next": "16.3.8",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@types/jest": "^29.5.14",
"@types/jest": "^30.0.0",
"@types/node": "^20",
"@types/react": "19.3.0",
"@types/react-dom": "19.3.0",
Expand All @@ -68,8 +68,8 @@
"eslint-config-next": "16.3.8",
"eslint-config-prettier": "^10.1.8",
"globals": "^17.13.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest": "^30.5.2",
"jest-environment-jsdom": "^30.5.2",
"postcss": "^8.5.29",
"prettier": "^3.9.9",
"tailwindcss": "^3.4.19",
Expand Down
Loading
Loading
0