-
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 1 commit
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,60 @@ | ||
| '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 |
||
|
|
||
| it(`should return true for valid password with 8 characters`, () => { | ||
| const result = checkPassword('Abcdef1!'); | ||
| expect(result).toBe(true); | ||
| }); | ||
|
|
||
| it(`should return true for valid password with 16 characters`, () => { | ||
| const result = checkPassword('Abcdefgh1234!XYZ'); | ||
| expect(result).toBe(true); | ||
| }); | ||
|
|
||
| it(`should return false for password shorter than 8 characters`, () => { | ||
| const result = checkPassword('Ab1!'); | ||
| expect(result).toBe(false); | ||
|
||
| }); | ||
|
|
||
| it(`should return false for password longer than 16 characters`, () => { | ||
| const result = checkPassword('Abcdefghijklmnop1!'); | ||
| expect(result).toBe(false); | ||
| }); | ||
|
||
|
|
||
| it(`should return false for password without uppercase letter`, () => { | ||
| const result = checkPassword('abcdef1!'); | ||
| expect(result).toBe(false); | ||
| }); | ||
|
||
|
|
||
| it(`should return false for password without digit`, () => { | ||
| const result = checkPassword('Abcdefgh!'); | ||
| expect(result).toBe(false); | ||
| }); | ||
|
|
||
| it(`should return 'true' for the valid password with 8 characters`, () => { | ||
| it(`should return false for password without special character`, () => { | ||
| const result = checkPassword('Abcdefg1'); | ||
| expect(result).toBe(false); | ||
|
||
| }); | ||
|
|
||
| it(`should return false for password with non-Latin characters`, () => { | ||
| const result = checkPassword('Пароль1!'); | ||
| expect(result).toBe(false); | ||
|
||
| }); | ||
|
|
||
| // write more tests here | ||
| it(`should return true for password with mix of allowed symbols`, () => { | ||
| const result = checkPassword('XyZ123@#'); | ||
| expect(result).toBe(true); | ||
| }); | ||
|
||
| }); | ||
|
|
||
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.