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.

utils.test.js 735B

1234567891011121314151617181920212223242526272829
  1. import {
  2. basename, extname, isObject, uniq, stripTags,
  3. } from './utils.js';
  4. test('basename', () => {
  5. expect(basename('/path/to/file.js')).toEqual('file.js');
  6. expect(basename('/path/to/file')).toEqual('file');
  7. expect(basename('file.js')).toEqual('file.js');
  8. });
  9. test('extname', () => {
  10. expect(extname('/path/to/file.js')).toEqual('.js');
  11. expect(extname('/path/')).toEqual('');
  12. expect(extname('/path')).toEqual('');
  13. expect(extname('file.js')).toEqual('.js');
  14. });
  15. test('isObject', () => {
  16. expect(isObject({})).toBeTrue();
  17. expect(isObject([])).toBeFalse();
  18. });
  19. test('uniq', () => {
  20. expect(uniq([1, 1, 1, 2])).toEqual([1, 2]);
  21. });
  22. test('stripTags', () => {
  23. expect(stripTags('<a>test</a>')).toEqual('test');
  24. });