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.
 
 
 
 
 
 

81 líneas
3.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, 'azYS7,olOL2]');
  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, 'azYS7,olOL2]iz');
  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, 'azYS7,olOL2]iz');
  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, 'obYT2=olOV9=');
  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, 'obYT2=olOV9=');
  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, 'AZ3[EQ7@OL2]');
  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, 'AZ3[EQ7@OL2]');
  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, 'AZ3[EQ7@OL2]');
  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, 'azYS7,olOL2]');
  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, 'az3[eq7@ol2]');
  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, 'az3[eq7@ol2]');
  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, 'azYS&uwAW@at');
  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, 'azYS&uwAW@at');
  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, 'azYS7uwAW8at');
  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, 'azYS7uwAW8at');
  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, 'onAV7&uvEC2=');
  66. });