mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
289da0f7b0
* sandbox-sync-agent * refactor: host pro as submodule * chore: checkpoint host pro restructure * refactor workspace test layout and startup init * chore: update next turbopack setup * chore: snapshot current work before actions fix * chore: update pro submodule * chore: point pro submodule url to upstream https * fix: Dockerfile * chore: update pro submodule * ci: support private pro submodule token and skip fork jobs * fix(ci): build sdk workspace deps before code-sandbox bundle * fix(app): exclude vitest configs from production typecheck * fix(app-image): build sdk packages before next build * fix(ci): align dockerfiles with workspace sdk build flow * chore(docker): upgrade node20 docker images to node24 * fix(ci): read admin coverage output path in pro test workflow * fix(app-image): include next-i18next config and locale assets * chore: update pro submodule * chore: do not specify branch for submodule * chore: remove most ts-nocheck sign * chore: update pro submodule * chore: remove sandbox-agent-sync package * chore: do not modify "pushData" file logic * fix: health check * chore: restore dev axios proxy state * fix: test-fastgpt report workflow * fix: use valid vitest coverage action inputs
36 lines
1.8 KiB
TypeScript
36 lines
1.8 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { checkPasswordRule } from '@fastgpt/global/common/string/password';
|
|
|
|
describe('PasswordRule', () => {
|
|
it('should be a valid password', () => {
|
|
// Small password
|
|
expect(checkPasswordRule('123ABC')).toBe(false);
|
|
expect(checkPasswordRule('@ga2123')).toBe(false);
|
|
|
|
// Test single type characters
|
|
expect(checkPasswordRule('123456')).toBe(false);
|
|
expect(checkPasswordRule('abcdef')).toBe(false); // only lowercase
|
|
expect(checkPasswordRule('ABCDEF')).toBe(false); // only uppercase
|
|
expect(checkPasswordRule('!@#$%^')).toBe(false); // only special chars
|
|
|
|
// Test two types combination
|
|
expect(checkPasswordRule('abcd1234')).toBe(true); // lowercase + numbers
|
|
expect(checkPasswordRule('abcdABCD')).toBe(true); // lowercase + uppercase
|
|
expect(checkPasswordRule('abcd!@#$')).toBe(true); // lowercase + special chars
|
|
expect(checkPasswordRule('ABCD!@#$')).toBe(true); // uppercase + special chars
|
|
expect(checkPasswordRule('ABCD1234')).toBe(true); // uppercase + numbers
|
|
expect(checkPasswordRule('1234!@#$')).toBe(true); // numbers + special chars
|
|
expect(checkPasswordRule('!@123fab')).toBe(true); // numbers + special chars
|
|
expect(checkPasswordRule('+2222()222')).toBe(true); // special chars + numbers
|
|
expect(checkPasswordRule('_2222()-+=22')).toBe(true); // special chars + numbers
|
|
|
|
// Test three types combination
|
|
expect(checkPasswordRule('abcABC123')).toBe(true); // lower + upper + numbers
|
|
expect(checkPasswordRule('abc123!@#')).toBe(true); // lower + numbers + special
|
|
expect(checkPasswordRule('abc!@#123')).toBe(true); // lower + special + numbers
|
|
|
|
// Test all four types
|
|
expect(checkPasswordRule('abcABC123!@#')).toBe(true); // all types
|
|
});
|
|
});
|