test: add vitest for unit tests (#50)
* feat: add vitest for unit tests * chore: address pull request feedback * test: add unit test code quality workflow
This commit is contained in:
19
packages/common/src/test/string.spec.ts
Normal file
19
packages/common/src/test/string.spec.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user