config.ts 845 B

123456789101112131415161718192021222324252627282930313233
  1. import test from 'ava';
  2. import Config from '../../src/lib/config';
  3. const conf = new Config();
  4. test('SET CONFIG', (t) => {
  5. conf.set('concurrency', 2, false);
  6. t.is(conf.get('concurrency'), 2);
  7. });
  8. test('GET CONFIG', (t) => {
  9. t.truthy(conf.get('cookies.arl'));
  10. t.is(typeof conf.get('coverSize.128'), 'number');
  11. t.is(typeof conf.get('coverSize.320'), 'number');
  12. t.is(typeof conf.get('coverSize.flac'), 'number');
  13. t.true(conf.get('trackNumber'));
  14. t.true(conf.get('fallbackTrack'));
  15. t.deepEqual(conf.get('saveLayout') as any, {
  16. track: 'Music/{ALB_TITLE}/{SNG_TITLE}',
  17. album: 'Music/{ALB_TITLE}/{SNG_TITLE}',
  18. artist: 'Music/{ALB_TITLE}/{SNG_TITLE}',
  19. playlist: 'Playlist/{TITLE}/{SNG_TITLE}',
  20. });
  21. });
  22. test('DELETE CONFIG', (t) => {
  23. conf.delete('cookies.arl');
  24. t.is(conf.get('cookies.arl'), undefined);
  25. });