-
Notifications
You must be signed in to change notification settings - Fork 1
feat(workspace): name tonight's first D.C. al Fine on the map #1091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
seonghobae
wants to merge
1
commit into
develop
Choose a base branch
from
feat/workspace-first-dc-al-fine
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| import { createDemoRehearsalSong } from "@bandscope/shared-types"; | ||
| import { describe, expect, it } from "vitest"; | ||
| import { | ||
| fillDcAlFineCopy, | ||
| firstDcAlFinePlan, | ||
| isTrustedDcAlFineLabel, | ||
| MAX_DC_AL_FINE_LABEL_LENGTH, | ||
| trustedDcAlFine | ||
| } from "./firstDcAlFine"; | ||
|
|
||
| describe("trustedDcAlFine", () => { | ||
| it("admits only own Gould/MusicXML D.C. al Fine and D.C. al Fine 1–9 labels", () => { | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine" })).toEqual({ label: "D.C. al Fine" }); | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine 1" })).toEqual({ label: "D.C. al Fine 1" }); | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine 9" })).toEqual({ label: "D.C. al Fine 9" }); | ||
| const inherited = Object.create({ label: "D.C. al Fine" }) as Record<string, unknown>; | ||
| expect(trustedDcAlFine(inherited)).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "d.c. al fine" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. Al Fine" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. AL FINE" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: " D.C. al Fine" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine " })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "Da Capo" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "Dal Segno" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "Fine" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "To Coda" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "Coda" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.S. al Coda" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. al Coda" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.S. al Fine" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "al Fine" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.S." })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C." })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine 0" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine 10" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "" })).toBeNull(); | ||
| expect(trustedDcAlFine({ label: "D.C. al Fine", extra: true })).toBeNull(); | ||
| expect(trustedDcAlFine({ text: "D.C. al Fine" })).toBeNull(); | ||
| expect(trustedDcAlFine(null)).toBeNull(); | ||
| expect(trustedDcAlFine("D.C. al Fine")).toBeNull(); | ||
| expect(MAX_DC_AL_FINE_LABEL_LENGTH).toBe(14); | ||
| }); | ||
| }); | ||
|
|
||
| describe("isTrustedDcAlFineLabel", () => { | ||
| it("rejects lowercase, sibling navigation, padded, and overlong tokens", () => { | ||
| expect(isTrustedDcAlFineLabel("D.C. al Fine")).toBe(true); | ||
| expect(isTrustedDcAlFineLabel("D.C. al Fine 2")).toBe(true); | ||
| expect(isTrustedDcAlFineLabel("d.c. al fine")).toBe(false); | ||
| expect(isTrustedDcAlFineLabel("D.C. al Fine 01")).toBe(false); | ||
| expect(isTrustedDcAlFineLabel("D.C. al Fine.")).toBe(false); | ||
| }); | ||
| }); | ||
|
|
||
| describe("firstDcAlFinePlan", () => { | ||
| it("builds a D.C. al Fine plan without inventing beginning or Fine destinations", () => { | ||
| expect(firstDcAlFinePlan(createDemoRehearsalSong())).toEqual({ label: "D.C. al Fine" }); | ||
| }); | ||
|
|
||
| it("ignores section order because the stored compound has no destination authority", () => { | ||
| expect( | ||
| firstDcAlFinePlan({ | ||
| dcAlFine: { label: "D.C. al Fine 2" }, | ||
| sections: [{ label: "intro" }, { label: "bridge" }, { label: "outro" }] | ||
| }) | ||
| ).toEqual({ label: "D.C. al Fine 2" }); | ||
| }); | ||
|
|
||
| it("fails closed without a trusted D.C. al Fine", () => { | ||
| const song = createDemoRehearsalSong(); | ||
| delete song.dcAlFine; | ||
| expect(firstDcAlFinePlan(song)).toBeNull(); | ||
| expect(firstDcAlFinePlan(undefined)).toBeNull(); | ||
| expect(firstDcAlFinePlan([])).toBeNull(); | ||
| }); | ||
| }); | ||
|
|
||
| describe("fillDcAlFineCopy", () => { | ||
| it("fills own-property tokens once and keeps rehearsal values literal", () => { | ||
| expect( | ||
| fillDcAlFineCopy("Tonight's first D.C. al Fine is {label}: return at {label}.", { | ||
| label: "D.C. al Fine {label}" | ||
| }) | ||
| ).toBe("Tonight's first D.C. al Fine is D.C. al Fine {label}: return at D.C. al Fine {label}."); | ||
| expect(fillDcAlFineCopy("keep {toString}", {})).toBe("keep {toString}"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: Absent markers remain backward-compatible
The custom deserializer defaults an absent
dcAlFinebut rejects explicit null. Legacy projects still load without gaining a synthetic marker.Was this helpful? React with 👍 or 👎 to provide feedback.