Skip to content

Commit 2aa4619

Browse files
committed
Fix tests
1 parent 456a7a6 commit 2aa4619

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

src/lib/inputvalidation/passwordValidator.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,51 +73,51 @@ describe('validatePasswordMatch', () => {
7373
});
7474

7575
describe('getPasswordStrength', () => {
76-
it('returns None/gray-500/0% for empty string', () => {
76+
it('returns None/gray/0% for empty string', () => {
7777
const { percent, text, color } = getPasswordStrength('');
7878
expect(percent).toBe(0);
7979
expect(text).toBe('None');
80-
expect(color).toBe('gray-500');
80+
expect(color).toBe('gray');
8181
});
8282

83-
it('rates a repeated single-character password as Very weak (red-500)', () => {
83+
it('rates a repeated single-character password as Very weak (red)', () => {
8484
// "aaaaaaaaaaaa" (12×'a'): uniqueLength=1 ⇒ entropy=0 ⇒ percent=0 ⇒ <30
8585
const pwd = 'a'.repeat(12);
8686
const { percent, text, color } = getPasswordStrength(pwd);
8787
expect(percent).toBe(0);
8888
expect(text).toBe('Very weak');
89-
expect(color).toBe('red-500');
89+
expect(color).toBe('red');
9090
});
9191

92-
it('rates a moderately varied 12-character password as Weak (orange-500)', () => {
92+
it('rates a moderately varied 12-character password as Weak (orange)', () => {
9393
// "abcABC123!@#": length=12, uniqueLength=12 ⇒ entropy≈43 ⇒ percent≈35.8 ⇒ <50
9494
const pwd = 'abcABC123!@#';
9595
const { percent, text, color } = getPasswordStrength(pwd);
9696
expect(percent).toBeGreaterThanOrEqual(30);
9797
expect(percent).toBeLessThan(50);
9898
expect(text).toBe('Weak');
99-
expect(color).toBe('orange-500');
99+
expect(color).toBe('orange');
100100
});
101101

102-
it('rates a 60-character password with two unique chars as Fair (yellow-500)', () => {
102+
it('rates a 60-character password with two unique chars as Fair (yellow)', () => {
103103
// 60×(two-character alphabet) ⇒ entropy=60*1=60 ⇒ percent=50 ⇒ <60
104104
const pwd = 'ab'.repeat(30);
105105
const { percent, text, color } = getPasswordStrength(pwd);
106106
expect(percent).toBeCloseTo(50, 1);
107107
expect(text).toBe('Fair');
108-
expect(color).toBe('yellow-500');
108+
expect(color).toBe('yellow');
109109
});
110110

111-
it('rates a 72-character password with two unique chars as Strong (green-500)', () => {
111+
it('rates a 72-character password with two unique chars as Strong (green)', () => {
112112
// 72×(two-character alphabet) ⇒ entropy=72 ⇒ percent=60 ⇒ <99
113113
const pwd = 'ab'.repeat(36);
114114
const { percent, text, color } = getPasswordStrength(pwd);
115115
expect(percent).toBeCloseTo(60, 1);
116116
expect(text).toBe('Strong');
117-
expect(color).toBe('green-500');
117+
expect(color).toBe('green');
118118
});
119119

120-
it('caps strength at 100% and rates as Very strong (cyan-500) for high entropy', () => {
120+
it('caps strength at 100% and rates as Very strong (cyan) for high entropy', () => {
121121
// 100 random characters
122122
const randomBytes = new Uint8Array(100);
123123
crypto.getRandomValues(randomBytes);
@@ -126,6 +126,6 @@ describe('getPasswordStrength', () => {
126126
const { percent, text, color } = getPasswordStrength(pwd);
127127
expect(percent).toBe(100);
128128
expect(text).toBe('Very strong');
129-
expect(color).toBe('cyan-500');
129+
expect(color).toBe('cyan');
130130
});
131131
});

0 commit comments

Comments
 (0)