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.
 
 
 
 
 
 

138 wiersze
5.0 KiB

  1. import test from 'ava';
  2. import execa from 'execa';
  3. test('default options', async t => {
  4. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password']);
  5. t.is(stdout, '\\g-A1-.OHEwrXjT#');
  6. });
  7. test('options can be before parameters', async t => {
  8. const {stdout} = await execa('./cli.js', ['-C', 'lesspass.com', 'contact@lesspass.com', 'password']);
  9. t.is(stdout, 'Copied to clipboard');
  10. });
  11. test('long options can be before parameters', async t => {
  12. const {stdout} = await execa('./cli.js', ['--clipboard', 'lesspass.com', 'contact@lesspass.com', 'password']);
  13. t.is(stdout, 'Copied to clipboard');
  14. });
  15. test('length', async t => {
  16. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--length=14']);
  17. t.is(stdout, '=0\\A-.OHEKvwrX');
  18. });
  19. test('length shortcut', async t => {
  20. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-L=14']);
  21. t.is(stdout, '=0\\A-.OHEKvwrX');
  22. });
  23. test('counter', async t => {
  24. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--counter=2']);
  25. t.is(stdout, 'Vf:F1\'!I`8Y2`GBE');
  26. });
  27. test('counter shortcut', async t => {
  28. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-c=2']);
  29. t.is(stdout, 'Vf:F1\'!I`8Y2`GBE');
  30. });
  31. test('no lowercase', async t => {
  32. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-lowercase']);
  33. t.is(stdout, 'JBG\\`3{+0[\"(E\\JJ');
  34. });
  35. test('no lowercase shortcut', async t => {
  36. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-uds']);
  37. t.is(stdout, 'JBG\\`3{+0[\"(E\\JJ');
  38. });
  39. test('only lowercase', async t => {
  40. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-l']);
  41. t.is(stdout, 'fmnujoqgcxmpffyh');
  42. });
  43. test('no uppercase', async t => {
  44. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-uppercase']);
  45. t.is(stdout, 'jbg\\`3{+0[\"(e\\jj');
  46. });
  47. test('no uppercase shortcut', async t => {
  48. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lds']);
  49. t.is(stdout, 'jbg\\`3{+0[\"(e\\jj');
  50. });
  51. test('only uppercase', async t => {
  52. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-u']);
  53. t.is(stdout, 'FMNUJOQGCXMPFFYH');
  54. });
  55. test('no digits', async t => {
  56. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-digits']);
  57. t.is(stdout, ';zkB#m]mNF$;J_Ej');
  58. });
  59. test('no digits shortcut', async t => {
  60. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lus']);
  61. t.is(stdout, ';zkB#m]mNF$;J_Ej');
  62. });
  63. test('only digits', async t => {
  64. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-d']);
  65. t.is(stdout, '7587019305478072');
  66. });
  67. test('no symbols', async t => {
  68. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-symbols']);
  69. t.is(stdout, 'OlfK63bmUhqrGODR');
  70. });
  71. test('no symbols shortcut', async t => {
  72. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lud']);
  73. t.is(stdout, 'OlfK63bmUhqrGODR');
  74. });
  75. test('only symbols', async t => {
  76. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-s']);
  77. t.is(stdout, '<"]|\'`%};\'`>-\'[,');
  78. });
  79. test('test space in password', async t => {
  80. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'my Master Password']);
  81. t.is(stdout, 'D1PBB34\\#fh!LY={');
  82. });
  83. test('doc 1', async t => {
  84. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-symbols']);
  85. t.is(stdout, 'OlfK63bmUhqrGODR');
  86. });
  87. test('doc 1 options before', async t => {
  88. const {stdout} = await execa('./cli.js', ['--no-symbols', 'lesspass.com', 'contact@lesspass.com', 'password']);
  89. t.is(stdout, 'OlfK63bmUhqrGODR');
  90. });
  91. test('doc 2', async t => {
  92. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lud']);
  93. t.is(stdout, 'OlfK63bmUhqrGODR');
  94. });
  95. test('doc 2 options before', async t => {
  96. const {stdout} = await execa('./cli.js', ['-lud', 'lesspass.com', 'contact@lesspass.com', 'password']);
  97. t.is(stdout, 'OlfK63bmUhqrGODR');
  98. });
  99. test('doc 3', async t => {
  100. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-d', '-L8']);
  101. t.is(stdout, '75837019');
  102. });
  103. test('doc 3 options before', async t => {
  104. const {stdout} = await execa('./cli.js', ['-d', '-L8', 'lesspass.com', 'contact@lesspass.com', 'password']);
  105. t.is(stdout, '75837019');
  106. });
  107. test('doc 3 options before and after', async t => {
  108. const {stdout} = await execa('./cli.js', ['-d', 'lesspass.com', 'contact@lesspass.com', 'password', '-L8']);
  109. t.is(stdout, '75837019');
  110. });