tests: add passphrase tests

This commit is contained in:
Aetherinox 2024-04-21 10:36:14 -07:00
parent 4bebac0685
commit dde3dde298
No known key found for this signature in database
GPG Key ID: CB5C4C30CD0D4028
1 changed files with 50 additions and 0 deletions

View File

@ -79,4 +79,54 @@ describe('PasswordGenerator', () => {
expect(password).to.match(/[O0oIl]/);
}
});
it('should generate passphrase with 8 words', () => {
expect(
PasswordGenerator.generate({
length: 8,
name: 'Passphrase',
spaces: true,
upper: true
})
).to.match(/^\w+(?: \w+){7,}$/);
});
it('should generate passphrase with 6 words ending in number', () => {
expect(
PasswordGenerator.generate({
length: 6,
name: 'Passphrase',
digits: true,
spaces: true,
upper: true
})
).to.match(/^\w+(?:[0-9] \w+){5,}$/);
});
it('should generate passphrase with 7 words seperated by hyphens', () => {
expect(
PasswordGenerator.generate({
length: 6,
name: 'Passphrase',
digits: false,
spaces: false,
high: true,
upper: true
})
).to.match(/^\w+(?:[\-]\w+){5,}$/);
});
it('should generate passphrase with 10 words seperated by hyphens, spaces with number at end', () => {
expect(
PasswordGenerator.generate({
length: 10,
name: 'Passphrase',
digits: true,
spaces: true,
high: true,
upper: true
})
).to.match(/^\w+(?: [\-] \w+[0-9]+){9,}$/);
});
});