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.
 
 
 
 
 
 

51 líneas
1.4 KiB

  1. import test from 'ava';
  2. import {mutations} from '../src/store/mutations';
  3. test('LOGOUT', t => {
  4. const {LOGOUT} = mutations;
  5. const state = {authenticated: true};
  6. LOGOUT(state);
  7. t.false(state.authenticated);
  8. });
  9. test('LOGIN', t => {
  10. const {LOGIN} = mutations;
  11. const state = {authenticated: false};
  12. LOGIN(state);
  13. t.true(state.authenticated);
  14. });
  15. test('SET_CURRENT_PASSWORD', t => {
  16. const {SET_CURRENT_PASSWORD} = mutations;
  17. const state = {currentPassword: null};
  18. SET_CURRENT_PASSWORD(state, {password: {uppercase: true, version: 2}});
  19. t.is(state.currentPassword.version, 2);
  20. t.true(state.currentPassword.uppercase);
  21. });
  22. test('SET_CURRENT_PASSWORD immutable', t => {
  23. const {SET_CURRENT_PASSWORD} = mutations;
  24. const state = {};
  25. const password = {version: 2};
  26. SET_CURRENT_PASSWORD(state, {password});
  27. password.version = 1;
  28. t.is(state.currentPassword.version, 2);
  29. });
  30. test('SET_DEFAULT_OPTIONS', t => {
  31. const {SET_DEFAULT_OPTIONS} = mutations;
  32. const state = {
  33. defaultOptions: {
  34. uppercase: true,
  35. lowercase: true,
  36. numbers: true,
  37. symbols: true,
  38. length: 16,
  39. counter: 1,
  40. version: 2
  41. }
  42. };
  43. SET_DEFAULT_OPTIONS(state, {options: {symbols: false, length: 30}});
  44. t.is(state.defaultOptions.length, 30);
  45. t.false(state.defaultOptions.symbols);
  46. });