You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 line
3.1 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', '--lowercase=false']);
  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', '-l=false']);
  29. t.is(stdout, 'JBG\\`3{+0[\"(E\\JJ');
  30. });
  31. test('boolean option case insensitive', async t => {
  32. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--lowercase=FalSe']);
  33. t.is(stdout, 'JBG\\`3{+0[\"(E\\JJ');
  34. });
  35. test('boolean option case insensitive', async t => {
  36. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--lowercase=TrUe']);
  37. t.is(stdout, '\\g-A1-.OHEwrXjT#');
  38. });
  39. test('no uppercase', async t => {
  40. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--uppercase=false']);
  41. t.is(stdout, 'jbg\\`3{+0[\"(e\\jj');
  42. });
  43. test('no uppercase shortcut', async t => {
  44. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-u=false']);
  45. t.is(stdout, 'jbg\\`3{+0[\"(e\\jj');
  46. });
  47. test('no numbers', async t => {
  48. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--numbers=false']);
  49. t.is(stdout, ';zkB#m]mNF$;J_Ej');
  50. });
  51. test('no numbers shortcut', async t => {
  52. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-n=false']);
  53. t.is(stdout, ';zkB#m]mNF$;J_Ej');
  54. });
  55. test('no symbols', async t => {
  56. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--symbols=false']);
  57. t.is(stdout, 'OlfK63bmUhqrGODR');
  58. });
  59. test('no symbols shortcut', async t => {
  60. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-s=false']);
  61. t.is(stdout, 'OlfK63bmUhqrGODR');
  62. });
  63. test('test space in password', async t => {
  64. const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'my Master Password']);
  65. t.is(stdout, 'D1PBB34\\#fh!LY={');
  66. });