45 lines
1.1 KiB
TypeScript
45 lines
1.1 KiB
TypeScript
import { expect, test } from "vitest";
|
|
import * as md from "@wyvern/markdown";
|
|
|
|
test("Bold", () => {
|
|
expect(md.bold("foo")).toEqual("**foo**");
|
|
});
|
|
|
|
test("Codeblock", () => {
|
|
expect(md.codeblock("foo")).toEqual("```\nfoo\n```");
|
|
expect(md.codeblock("foo", "js")).toEqual("```js\nfoo\n```");
|
|
});
|
|
|
|
test("Heading", () => {
|
|
expect(md.h1("foo")).toEqual("# foo");
|
|
expect(md.h2("foo")).toEqual("## foo");
|
|
expect(md.h3("foo")).toEqual("### foo");
|
|
});
|
|
|
|
test("Italic", () => {
|
|
expect(md.italic("foo")).toEqual("_foo_");
|
|
});
|
|
|
|
test("Mention", () => {
|
|
expect(md.mention("channel", "123")).toEqual("<#123>");
|
|
expect(md.mention("role", "123")).toEqual("<@&123>");
|
|
expect(md.mention("user", "123")).toEqual("<@123>");
|
|
});
|
|
|
|
test("Quote", () => {
|
|
expect(md.quote("foo")).toEqual("> foo");
|
|
expect(md.blockQuote("foo")).toEqual(">>> foo");
|
|
});
|
|
|
|
test("Spoiler", () => {
|
|
expect(md.spoiler("foo")).toEqual("||foo||");
|
|
});
|
|
|
|
test("Strikethrough", () => {
|
|
expect(md.strikethrough("foo")).toEqual("~~foo~~");
|
|
});
|
|
|
|
test("Underline", () => {
|
|
expect(md.strikethrough("foo")).toEqual("~~foo~~");
|
|
});
|