mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-26 14:54:55 +00:00
code: valid,is,dbal (3 files)
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { isValidSlug } from '../../../src/core/validation/is-valid-slug'
|
||||
|
||||
const maxSlug = 'a'.repeat(100)
|
||||
const tooLongSlug = 'a'.repeat(101)
|
||||
const maxSlug = 'a'.repeat(255)
|
||||
const tooLongSlug = 'a'.repeat(256)
|
||||
|
||||
describe('isValidSlug', () => {
|
||||
it.each([
|
||||
{ slug: 'my-page-1', expected: true, description: 'lowercase with hyphens' },
|
||||
{ slug: 'docs/getting-started', expected: true, description: 'includes slashes' },
|
||||
{ slug: 'a', expected: true, description: 'single character' },
|
||||
{ slug: maxSlug, expected: true, description: 'max length' },
|
||||
{ slug: '', expected: false, description: 'empty string' },
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import { isValidTitle } from '../../../src/core/validation/is-valid-title'
|
||||
|
||||
const maxTitle = 'a'.repeat(200)
|
||||
const tooLongTitle = 'a'.repeat(201)
|
||||
const maxTitle = 'a'.repeat(255)
|
||||
const tooLongTitle = 'a'.repeat(256)
|
||||
|
||||
describe('isValidTitle', () => {
|
||||
it.each([
|
||||
|
||||
@@ -6,6 +6,7 @@ const fiftyOneChars = 'a'.repeat(51)
|
||||
|
||||
describe('isValidUsername', () => {
|
||||
it.each([
|
||||
{ username: 'ab', expected: false, description: 'too short' },
|
||||
{ username: 'user', expected: true, description: 'simple username' },
|
||||
{ username: 'user_name-123', expected: true, description: 'allowed symbols' },
|
||||
{ username: fiftyChars, expected: true, description: 'max length' },
|
||||
|
||||
Reference in New Issue
Block a user