mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 17:00:54 +01:00
* feat: add vitest for unit tests * chore: address pull request feedback * test: add unit test code quality workflow
20 lines
500 B
TypeScript
20 lines
500 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
|
|
import { capitalize } from "../string";
|
|
|
|
const capitalizeTestCases = [
|
|
["hello", "Hello"],
|
|
["World", "World"],
|
|
["123", "123"],
|
|
["a", "A"],
|
|
["two words", "Two words"],
|
|
] as const;
|
|
|
|
describe("capitalize should capitalize the first letter of a string", () => {
|
|
capitalizeTestCases.forEach(([input, expected]) => {
|
|
it(`should capitalize ${input} to ${expected}`, () => {
|
|
expect(capitalize(input)).toEqual(expected);
|
|
});
|
|
});
|
|
});
|