Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

api.tests.js 2.8 KiB

8 lat temu
8 lat temu
8 lat temu
8 lat temu
8 lat temu
8 lat temu
8 lat temu
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. var assert = chai.assert;
  2. describe('LessPass v2', function () {
  3. describe('API', function () {
  4. it('render password', function () {
  5. this.timeout(10000);
  6. var site = 'example.org';
  7. var login = 'contact@example.org';
  8. var masterPassword = 'password';
  9. var passwordProfile = {
  10. lowercase: true,
  11. uppercase: true,
  12. digits: true,
  13. symbols: true,
  14. length: 16,
  15. index: 1,
  16. version: 2
  17. };
  18. return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) {
  19. assert.equal('WHLpUL)e00[iHR+w', generatedPassword);
  20. });
  21. });
  22. it('render password no symbols', function () {
  23. this.timeout(10000);
  24. var site = 'example.org';
  25. var login = 'contact@example.org';
  26. var masterPassword = 'password';
  27. var passwordProfile = {
  28. lowercase: true,
  29. uppercase: true,
  30. digits: true,
  31. symbols: false,
  32. length: 14,
  33. index: 2,
  34. version: 2
  35. };
  36. return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) {
  37. assert.equal('MBAsB7b1Prt8Sl', generatedPassword);
  38. });
  39. });
  40. it('render password only digit', function () {
  41. this.timeout(10000);
  42. var site = 'example.org';
  43. var login = 'contact@example.org';
  44. var masterPassword = 'password';
  45. var passwordProfile = {
  46. lowercase: false,
  47. uppercase: false,
  48. digits: true,
  49. symbols: false,
  50. length: 6,
  51. index: 3,
  52. version: 2
  53. };
  54. return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) {
  55. assert.equal('117843', generatedPassword);
  56. });
  57. });
  58. it('render password no number', function () {
  59. this.timeout(10000);
  60. var site = 'example.org';
  61. var login = 'contact@example.org';
  62. var masterPassword = 'password';
  63. var passwordProfile = {
  64. lowercase: true,
  65. uppercase: true,
  66. digits: false,
  67. symbols: true,
  68. length: 14,
  69. index: 1,
  70. version: 2
  71. };
  72. return LessPass.generatePassword(site, login, masterPassword, passwordProfile).then(function (generatedPassword) {
  73. assert.equal("sB>{qF}wN%/-fm", generatedPassword);
  74. });
  75. });
  76. });
  77. });