Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

66 righe
1.7 KiB

  1. import test from 'ava';
  2. import Password from '../src/domain/password';
  3. test('password is new if no passwords', t => {
  4. const password = new Password({site: 'example.org'});
  5. t.true(password.isNewPassword([]))
  6. });
  7. test('password is new if no site matching', t => {
  8. const password = new Password({site: 'example.org'});
  9. t.true(password.isNewPassword([{site: 'ubuntu.org'}]))
  10. });
  11. test('password is new if site match but no login', t => {
  12. const password = new Password({site: 'example.org', login: 'test'});
  13. t.true(password.isNewPassword([{site: 'example.org', login: 'test@example.org'}]))
  14. });
  15. test('password is not new if site and login matching', t => {
  16. const password = new Password({site: 'example.org', login: 'test'});
  17. t.false(password.isNewPassword([{site: 'example.org', login: 'test'}]))
  18. });
  19. test('password options default', t => {
  20. const password = new Password({
  21. site: 'example.org',
  22. login: 'test',
  23. uppercase: true,
  24. lowercase: true,
  25. numbers: true,
  26. symbols: true,
  27. length: 12,
  28. counter: 1,
  29. });
  30. t.deepEqual(password.options, {
  31. uppercase: true,
  32. lowercase: true,
  33. numbers: true,
  34. symbols: true,
  35. length: 12,
  36. counter: 1,
  37. })
  38. });
  39. test('password options', t => {
  40. const password = new Password({
  41. site: 'example.org',
  42. login: 'test',
  43. uppercase: false,
  44. lowercase: true,
  45. numbers: false,
  46. symbols: true,
  47. length: 14,
  48. counter: 3,
  49. });
  50. t.deepEqual(password.options, {
  51. uppercase: false,
  52. lowercase: true,
  53. numbers: false,
  54. symbols: true,
  55. length: 14,
  56. counter: 3,
  57. })
  58. });