No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

store.getters.js 1.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import test from 'ava';
  2. import * as getters from '../src/store/getters';
  3. test('version', t => {
  4. const state = {
  5. route: {path: '/'},
  6. password: {version: 2},
  7. defaultPassword: {version: 1}
  8. };
  9. const version = getters.version(state);
  10. t.is(version, 2);
  11. });
  12. test('version path equal default options', t => {
  13. const state = {
  14. route: {path: '/options/default'},
  15. password: {version: 2},
  16. defaultPassword: {version: 1}
  17. };
  18. const version = getters.version(state);
  19. t.is(version, 1);
  20. });
  21. test('version no password', t => {
  22. const state = {
  23. route: {path: '/'},
  24. password: null,
  25. defaultPassword: {version: 1}
  26. };
  27. const version = getters.version(state);
  28. t.is(version, 1);
  29. });
  30. test('passwordURL', t => {
  31. const state = {
  32. password: {
  33. login: "test@example.org",
  34. site: "example.org",
  35. uppercase: true,
  36. lowercase: true,
  37. numbers: true,
  38. symbols: false,
  39. length: 16,
  40. counter: 1,
  41. version: 2
  42. },
  43. baseURL: 'https://lesspass.com'
  44. };
  45. t.is(getters.passwordURL(state), 'https://lesspass.com/#/?login=test@example.org&site=example.org&uppercase=true&lowercase=true&numbers=true&symbols=false&length=16&counter=1&version=2')
  46. });