mirror of
https://github.com/maputnik/editor.git
synced 2026-08-24 05:57:25 +00:00
f14eeae38b
## Launch Checklist This PR increases coverage by adding unit tests to lib folde, replace the skipped end to end placeholder with actual tests and adds more end to end tests. This was mostly done by AI (Claude opus 4.8) and I reviewed it and requested changes where needed. - [x] Briefly describe the changes in this PR. - [x] Link to related issues. - [x] Include before/after visuals or gifs if this PR includes visual changes. - [x] Write tests for all new functionality. - [x] Add an entry to `CHANGELOG.md` under the `## main` section. --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
18 lines
783 B
TypeScript
18 lines
783 B
TypeScript
import { describe, it, expect } from "vitest";
|
|
import { findDefaultFromSpec } from "./spec-helper";
|
|
|
|
describe("findDefaultFromSpec", () => {
|
|
it("returns the spec default when present (even if falsy)", () => {
|
|
expect(findDefaultFromSpec({ type: "string", default: "hi" })).toBe("hi");
|
|
expect(findDefaultFromSpec({ type: "boolean", default: false })).toBe(false);
|
|
});
|
|
|
|
it("falls back to a sensible default per type", () => {
|
|
expect(findDefaultFromSpec({ type: "color" })).toBe("#000000");
|
|
expect(findDefaultFromSpec({ type: "string" })).toBe("");
|
|
// The falsy `false` fallback collapses to "" via the `|| ""` in the impl.
|
|
expect(findDefaultFromSpec({ type: "boolean" })).toBe("");
|
|
expect(findDefaultFromSpec({ type: "array" })).toEqual([]);
|
|
});
|
|
});
|