mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-10 14:10:59 +08:00
Adding tests for isTagPresetNameValid (#4402) gondolin24
* Adding tests for isTagPresetNameValid * more generic tag names added more tests --------- Co-authored-by: Miodec <jack@monkeytype.com>
This commit is contained in:
parent
e4f151d880
commit
cc95aff900
1 changed files with 44 additions and 0 deletions
|
|
@ -1,6 +1,50 @@
|
|||
import * as Validation from "../../src/utils/validation";
|
||||
import { isTagPresetNameValid } from "../../src/utils/validation";
|
||||
|
||||
describe("Validation", () => {
|
||||
it("isTagPresetNameValid", () => {
|
||||
const testCases = [
|
||||
{
|
||||
name: "valid_name",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "validname",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "valid-name",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "valid.name",
|
||||
expected: true,
|
||||
},
|
||||
{
|
||||
name: "thistagnameistoolong",
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "",
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "invalid name",
|
||||
expected: false,
|
||||
},
|
||||
{
|
||||
name: "invalid=name",
|
||||
expected: false,
|
||||
},
|
||||
];
|
||||
|
||||
testCases.forEach((testCase) => {
|
||||
expect(Validation.isTagPresetNameValid(testCase.name)).toBe(
|
||||
testCase.expected
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
it("inRange", () => {
|
||||
const testCases = [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue