Apply repository-wide ESLint auto-fix formatting pass

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
2026-03-08 12:11:57 +08:00
parent 7c48faaa3d
commit 847904c49b
172 changed files with 13629 additions and 9154 deletions

View File

@@ -3,15 +3,15 @@
// Authors:
// imacat.yang@dsp.im (imacat), 2026/03/06
import { describe, it, expect, beforeEach } from 'vitest';
import { describe, it, expect, beforeEach } from "vitest";
describe('router beforeEach guard logic', () => {
describe("router beforeEach guard logic", () => {
beforeEach(() => {
// Clear cookies
document.cookie.split(';').forEach((c) => {
const name = c.split('=')[0].trim();
document.cookie.split(";").forEach((c) => {
const name = c.split("=")[0].trim();
if (name) {
document.cookie = name + '=; Max-Age=-99999999; path=/';
document.cookie = name + "=; Max-Age=-99999999; path=/";
}
});
});
@@ -19,26 +19,26 @@ describe('router beforeEach guard logic', () => {
// Simulate the guard logic from router/index.ts
function runGuard(to) {
const isLoggedIn = document.cookie
.split(';')
.some((c) => c.trim().startsWith('isLuciaLoggedIn='));
.split(";")
.some((c) => c.trim().startsWith("isLuciaLoggedIn="));
if (to.name === 'Login') {
if (isLoggedIn) return { name: 'Files' };
if (to.name === "Login") {
if (isLoggedIn) return { name: "Files" };
}
return undefined;
}
it('redirects logged-in user from Login to Files', () => {
document.cookie = 'isLuciaLoggedIn=true';
expect(runGuard({ name: 'Login' })).toEqual({ name: 'Files' });
it("redirects logged-in user from Login to Files", () => {
document.cookie = "isLuciaLoggedIn=true";
expect(runGuard({ name: "Login" })).toEqual({ name: "Files" });
});
it('allows unauthenticated user to visit Login', () => {
expect(runGuard({ name: 'Login' })).toBeUndefined();
it("allows unauthenticated user to visit Login", () => {
expect(runGuard({ name: "Login" })).toBeUndefined();
});
it('does not interfere with non-Login routes', () => {
document.cookie = 'isLuciaLoggedIn=true';
expect(runGuard({ name: 'Files' })).toBeUndefined();
it("does not interfere with non-Login routes", () => {
document.cookie = "isLuciaLoggedIn=true";
expect(runGuard({ name: "Files" })).toBeUndefined();
});
});