mirror of
https://github.com/mmomm-org/obsidian-newtab.git
synced 2026-07-22 07:43:53 +00:00
Own version of obsidian-beautitab (MIT): its React + SCSS new-tab dashboard source dropped onto the MiYo Obsidian-plugin pipeline (esbuild + esbuild-sass- plugin, semantic-release, CI with build-provenance attestation, vitest, eslint- obsidianmd + stylelint browser-compat on compiled CSS). - Renamed Beautitab -> NewTab throughout; plugin id "newtab", name "New Tab". - esbuild adapted for React (jsx automatic) + SCSS (styles.scss -> styles.css). - Version check re-pointed to MMoMM-org/obsidian-newtab; removed esbuild-serve EventSource block (dev uses the hot-reload test vault instead). - PRIVACY.md documents outbound hosts (Unsplash, Quotable, version check). - Lean/standalone: no MiYo CLAUDE.md/handoff/governance scaffolding. Gates: build, typecheck, and tests (4) pass; lint is error-free. Inherited type-aware eslint findings are downgraded to documented fork-debt warnings. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import capitalizeFirstLetter from "../src/Utils/capitalizeFirstLetter";
|
|
import {
|
|
isWithinDaysBefore,
|
|
isWithinDaysAfter,
|
|
} from "../React/Utils/isWithinXDays";
|
|
|
|
describe("capitalizeFirstLetter", () => {
|
|
it("capitalizes the first character", () => {
|
|
expect(capitalizeFirstLetter("hello")).toBe("Hello");
|
|
});
|
|
|
|
it("leaves an already-capitalized string unchanged", () => {
|
|
expect(capitalizeFirstLetter("World")).toBe("World");
|
|
});
|
|
});
|
|
|
|
describe("isWithinXDays", () => {
|
|
const base = new Date("2026-06-10T00:00:00Z");
|
|
|
|
it("detects a date within N days before", () => {
|
|
const earlier = new Date("2026-06-07T00:00:00Z");
|
|
expect(isWithinDaysBefore(earlier, 5, base)).toBe(true);
|
|
expect(isWithinDaysBefore(new Date("2026-06-01T00:00:00Z"), 5, base)).toBe(
|
|
false,
|
|
);
|
|
});
|
|
|
|
it("detects a date within N days after", () => {
|
|
const later = new Date("2026-06-13T00:00:00Z");
|
|
expect(isWithinDaysAfter(later, 5, base)).toBe(true);
|
|
expect(isWithinDaysAfter(new Date("2026-06-20T00:00:00Z"), 5, base)).toBe(
|
|
false,
|
|
);
|
|
});
|
|
});
|