Move functions to outer scope for clarity (S7721)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -155,6 +155,24 @@ export function timeRange(minTime, maxTime, amount) {
|
|||||||
timeRange = timeRange.map((value) => Math.round(value));
|
timeRange = timeRange.map((value) => Math.round(value));
|
||||||
return timeRange;
|
return timeRange;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Cubic Bezier curve formula.
|
||||||
|
* @param {number} t - The interpolation parameter (0 to 1).
|
||||||
|
* @param {number} a1 - Control point 1.
|
||||||
|
* @param {number} a2 - Control point 2.
|
||||||
|
* @param {number} a3 - Control point 3.
|
||||||
|
* @param {number} a4 - Control point 4.
|
||||||
|
* @returns {number} The interpolated value.
|
||||||
|
*/
|
||||||
|
function threebsr(t, a1, a2, a3, a4) {
|
||||||
|
return (
|
||||||
|
(1 - t) * (1 - t) * (1 - t) * a1 +
|
||||||
|
3 * t * (1 - t) * (1 - t) * a2 +
|
||||||
|
3 * t * t * (1 - t) * a3 +
|
||||||
|
t * t * t * a4
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates smooth Y-axis values using cubic Bezier interpolation
|
* Generates smooth Y-axis values using cubic Bezier interpolation
|
||||||
* to produce evenly spaced ticks matching the X-axis divisions.
|
* to produce evenly spaced ticks matching the X-axis divisions.
|
||||||
@@ -169,16 +187,6 @@ export function yTimeRange(data, yAmount, yMax) {
|
|||||||
const yRange = [];
|
const yRange = [];
|
||||||
const yGap = 1 / (yAmount - 1);
|
const yGap = 1 / (yAmount - 1);
|
||||||
|
|
||||||
// Cubic Bezier curve formula
|
|
||||||
const threebsr = function (t, a1, a2, a3, a4) {
|
|
||||||
return (
|
|
||||||
(1 - t) * (1 - t) * (1 - t) * a1 +
|
|
||||||
3 * t * (1 - t) * (1 - t) * a2 +
|
|
||||||
3 * t * t * (1 - t) * a3 +
|
|
||||||
t * t * t * a4
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
for (let j = 0; j < data.length - 1; j++) {
|
for (let j = 0; j < data.length - 1; j++) {
|
||||||
for (let i = 0; i <= 1; i += yGap * 11) {
|
for (let i = 0; i <= 1; i += yGap * 11) {
|
||||||
yRange.push(
|
yRange.push(
|
||||||
|
|||||||
@@ -7,17 +7,6 @@ import { describe, it, expect, beforeEach } from "vitest";
|
|||||||
import { decodeReturnTo } from "@/utils/returnToEncoding";
|
import { decodeReturnTo } from "@/utils/returnToEncoding";
|
||||||
import { evaluateAuthNavigation } from "@/router/authGuard";
|
import { evaluateAuthNavigation } from "@/router/authGuard";
|
||||||
|
|
||||||
describe("router beforeEach guard logic", () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
// Clear cookies
|
|
||||||
document.cookie.split(";").forEach((c) => {
|
|
||||||
const name = c.split("=")[0].trim();
|
|
||||||
if (name) {
|
|
||||||
document.cookie = name + "=; Max-Age=-99999999; path=/";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Run the real auth guard decision logic from src/router/authGuard.ts
|
// Run the real auth guard decision logic from src/router/authGuard.ts
|
||||||
async function runGuard(to, options = {}) {
|
async function runGuard(to, options = {}) {
|
||||||
const { refreshSucceeds = true } = options;
|
const { refreshSucceeds = true } = options;
|
||||||
@@ -44,6 +33,17 @@ describe("router beforeEach guard logic", () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
describe("router beforeEach guard logic", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
// Clear cookies
|
||||||
|
document.cookie.split(";").forEach((c) => {
|
||||||
|
const name = c.split("=")[0].trim();
|
||||||
|
if (name) {
|
||||||
|
document.cookie = name + "=; Max-Age=-99999999; path=/";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("redirects logged-in user from Login to Files", () => {
|
it("redirects logged-in user from Login to Files", () => {
|
||||||
document.cookie = "isLuciaLoggedIn=true";
|
document.cookie = "isLuciaLoggedIn=true";
|
||||||
document.cookie = "luciaToken=token";
|
document.cookie = "luciaToken=token";
|
||||||
|
|||||||
Reference in New Issue
Block a user