Refactor Study Desk application structure
This commit is contained in:
parent
faaccf8a7e
commit
089439ed90
145 changed files with 8087 additions and 3412 deletions
34
src/lib/shareMetadata.test.ts
Normal file
34
src/lib/shareMetadata.test.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { buildShareMetadata, type ShareMetaLink } from "./shareMetadata";
|
||||
|
||||
describe("buildShareMetadata", () => {
|
||||
const deckLink: ShareMetaLink = {
|
||||
targetType: "DECK",
|
||||
deck: {
|
||||
name: "Deck",
|
||||
description: null,
|
||||
class: { slug: "class", name: "Class" },
|
||||
_count: { cards: 3 },
|
||||
},
|
||||
quizSet: null,
|
||||
group: null,
|
||||
};
|
||||
|
||||
it("does not describe a token under a mismatched shared route type", () => {
|
||||
expect(
|
||||
buildShareMetadata(deckLink, {
|
||||
classSlug: "class",
|
||||
pathType: "quizzes",
|
||||
}).title
|
||||
).toBe("Study Desk");
|
||||
});
|
||||
|
||||
it("describes the target only when token, class, and route type agree", () => {
|
||||
expect(
|
||||
buildShareMetadata(deckLink, {
|
||||
classSlug: "class",
|
||||
pathType: "flashcards",
|
||||
}).title
|
||||
).toContain("Deck");
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue