Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

92 rader
3.4 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('length', async t => {
  8. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--length=14']);
  9. t.is(stdout, '=0\\A-.OHEKvwrX');
  10. });
  11. test('length shortcut', async t => {
  12. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-L=14']);
  13. t.is(stdout, '=0\\A-.OHEKvwrX');
  14. });
  15. test('counter', async t => {
  16. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--counter=2']);
  17. t.is(stdout, 'Vf:F1\'!I`8Y2`GBE');
  18. });
  19. test('counter shortcut', async t => {
  20. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-c=2']);
  21. t.is(stdout, 'Vf:F1\'!I`8Y2`GBE');
  22. });
  23. test('no lowercase', async t => {
  24. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-lowercase']);
  25. t.is(stdout, 'JBG\\`3{+0[\"(E\\JJ');
  26. });
  27. test('no lowercase shortcut', async t => {
  28. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-uds']);
  29. t.is(stdout, 'JBG\\`3{+0[\"(E\\JJ');
  30. });
  31. test('only lowercase', async t => {
  32. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-l']);
  33. t.is(stdout, 'fmnujoqgcxmpffyh');
  34. });
  35. test('no uppercase', async t => {
  36. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-uppercase']);
  37. t.is(stdout, 'jbg\\`3{+0[\"(e\\jj');
  38. });
  39. test('no uppercase shortcut', async t => {
  40. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lds']);
  41. t.is(stdout, 'jbg\\`3{+0[\"(e\\jj');
  42. });
  43. test('only uppercase', async t => {
  44. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-u']);
  45. t.is(stdout, 'FMNUJOQGCXMPFFYH');
  46. });
  47. test('no digits', async t => {
  48. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-digits']);
  49. t.is(stdout, ';zkB#m]mNF$;J_Ej');
  50. });
  51. test('no digits shortcut', async t => {
  52. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lus']);
  53. t.is(stdout, ';zkB#m]mNF$;J_Ej');
  54. });
  55. test('only digits', async t => {
  56. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-d']);
  57. t.is(stdout, '7587019305478072');
  58. });
  59. test('no symbols', async t => {
  60. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--no-symbols']);
  61. t.is(stdout, 'OlfK63bmUhqrGODR');
  62. });
  63. test('no symbols shortcut', async t => {
  64. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-lud']);
  65. t.is(stdout, 'OlfK63bmUhqrGODR');
  66. });
  67. test('only symbols', async t => {
  68. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-s']);
  69. t.is(stdout, '<"]|\'`%};\'`>-\'[,');
  70. });
  71. test('test space in password', async t => {
  72. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'my Master Password']);
  73. t.is(stdout, 'D1PBB34\\#fh!LY={');
  74. });