-
Notifications
You must be signed in to change notification settings - Fork 155
QA: Sprawdzenie poprawności hasła #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ec96e03
f34aa28
39f96a5
79f0b09
05670aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,75 @@ | ||
| 'use strict'; | ||
|
|
||
| describe(`Function 'checkPassword':`, () => { | ||
| const checkPassword = require('./checkPassword'); | ||
| const checkPassword = require('./checkPassword'); | ||
|
|
||
| describe(`Function 'checkPassword':`, () => { | ||
| it(`should be declared`, () => { | ||
| expect(checkPassword).toBeInstanceOf(Function); | ||
| }); | ||
|
|
||
| it(`should return boolean`, () => { | ||
| it(`should return a boolean`, () => { | ||
| const result = checkPassword('Password1!'); | ||
| expect(typeof result).toBe('boolean'); | ||
| }); | ||
|
Comment on lines
+10
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test only asserts the return type for |
||
|
|
||
| // README examples | ||
| it(`should return true for checkPassword('Password1!')`, () => { | ||
| expect(checkPassword('Password1!')).toBe(true); | ||
| }); | ||
|
|
||
| it(`should return 'true' for the valid password with 8 characters`, () => { | ||
| it(`should return false for checkPassword('qwerty')`, () => { | ||
| expect(checkPassword('qwerty')).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return false for checkPassword('Str@ng')`, () => { | ||
| expect(checkPassword('Str@ng')).toBe(false); | ||
| }); | ||
|
|
||
| // write more tests here | ||
| // Length boundaries | ||
| it(`should return false for 7-character password`, () => { | ||
| expect(checkPassword('Abcde1!')).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return true for 8-character valid password`, () => { | ||
| expect(checkPassword('Abcdef1!')).toBe(true); | ||
| }); | ||
|
|
||
| it(`should return true for 16-character valid password`, () => { | ||
| expect(checkPassword('Abcdefgh1234!XYZ')).toBe(true); | ||
| }); | ||
|
|
||
| it(`should return false for 17-character password`, () => { | ||
| // 15 liter + 1 cyfra + 1 znak specjalny = 17 znaków | ||
| expect(checkPassword('Abcdefghijklmno1!')).toBe(false); | ||
| }); | ||
|
|
||
| // Character class coverage | ||
| it(`should return false for password without uppercase`, () => { | ||
| expect(checkPassword('abcdef1!')).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return false for password without digit`, () => { | ||
| expect(checkPassword('Abcdefgh!')).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return false for password without special char`, () => { | ||
| expect(checkPassword('Abcdefg1')).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return true for uppercase-only valid password`, () => { | ||
| expect(checkPassword('ABCDEF12!')).toBe(true); | ||
| }); | ||
|
|
||
| it(`should return false for password with Cyrillic letters`, () => { | ||
| expect(checkPassword('Пароль1!')).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return false for password with accented Latin letters`, () => { | ||
| expect(checkPassword('Pässword1!')).toBe(false); | ||
| }); | ||
|
|
||
| // Whitespace check | ||
| it(`should return false for password containing whitespace`, () => { | ||
| expect(checkPassword('Abc def1!')).toBe(false); | ||
| }); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The import line is fine —
require('./checkPassword')is correct and necessary for these tests. No change required here.