25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.7 KiB

  1. var assert = chai.assert;
  2. describe('LessPass v1', function () {
  3. describe('prettyPrint', function () {
  4. it('should print different password if templates different', function () {
  5. var encryptedLogin = '78ae5892055ab59fdd54489ae30928d322841a27590b65cf875fcfdd083f7c32';
  6. assert.notEqual(LessPass._prettyPrint(encryptedLogin, 'cv'), LessPass._prettyPrint(encryptedLogin, 'vc'));
  7. });
  8. it('must return a string of the same length as the input', function () {
  9. var hash = 'f5785e569ab5d38b02e2248c798ac17df90f57a85f34a9d5382408c2f0d9532d';
  10. assert.equal(hash.length, LessPass._prettyPrint(hash, 'cv').length);
  11. });
  12. it('should return char inside a string based on modulo of the index', function () {
  13. var template = 'cv';
  14. assert.equal('c', LessPass._getCharType(template, 0));
  15. assert.equal('v', LessPass._getCharType(template, 1));
  16. assert.equal('c', LessPass._getCharType(template, 10));
  17. });
  18. it('should convert a string into an array of char code', function () {
  19. var charCodes = LessPass._string2charCodes('ab40f6ee71');
  20. assert.equal(97, charCodes[0]);
  21. assert.equal(98, charCodes[1]);
  22. assert.equal(10, charCodes.length);
  23. });
  24. it('should get password char based on its type and index', function () {
  25. var typeVowel = 'V';
  26. assert.equal('A', LessPass._getPasswordChar(typeVowel, 0));
  27. });
  28. it('should modulo if overflow', function () {
  29. var typeVowel = 'V';
  30. assert.equal('E', LessPass._getPasswordChar(typeVowel, 1));
  31. assert.equal('E', LessPass._getPasswordChar(typeVowel, 7));
  32. });
  33. });
  34. });