Files
supabase/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.test.ts
Joshen Lim a71bab0f1c Warn for certain symbols in database passwords (#33210)
* Prevent certain symbols in database passwords

* Update

* Update copy

* Address feedback

* Update copy

* Update apps/studio/components/interfaces/ProjectCreation/SpecialSymbolsCallout.tsx

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>

---------

Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2025-02-04 11:05:55 +08:00

11 lines
506 B
TypeScript

import { expect, test } from 'vitest'
import { SPECIAL_CHARS_REGEX } from './ProjectCreation.constants'
test('Regex test to surface if password contains @, : or /', () => {
expect(!'teststring'.match(SPECIAL_CHARS_REGEX)).toEqual(false)
expect(!'test@string'.match(SPECIAL_CHARS_REGEX)).toEqual(true)
expect(!'te:ststring'.match(SPECIAL_CHARS_REGEX)).toEqual(true)
expect(!`tests/tring`.match(SPECIAL_CHARS_REGEX)).toEqual(true)
expect(!'!#$%^&*()'.match(SPECIAL_CHARS_REGEX)).toEqual(false)
})