1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-10 04:07:35 +02:00
pigallery2/test/common/unit/UserDTO.ts

27 lines
1.4 KiB
TypeScript
Raw Normal View History

2018-03-30 21:30:30 +02:00
import {expect} from 'chai';
import {UserDTO, UserDTOUtils} from '../../../src/common/entities/UserDTO';
2018-02-04 02:50:42 +02:00
describe('UserDTO', () => {
it('should check available path', () => {
expect(UserDTOUtils.isDirectoryPathAvailable('/', ['/'])).to.be.equals(true);
expect(UserDTOUtils.isDirectoryPathAvailable('/', ['/subfolder', '/'])).to.be.equals(true);
expect(UserDTOUtils.isDirectoryPathAvailable('/abc', ['/subfolder', '/'])).to.be.equals(false);
expect(UserDTOUtils.isDirectoryPathAvailable('/abc', ['/subfolder', '/*'])).to.be.equals(true);
expect(UserDTOUtils.isDirectoryPathAvailable('/abc', ['/subfolder'])).to.be.equals(false);
expect(UserDTOUtils.isDirectoryPathAvailable('/abc/two', ['/subfolder'])).to.be.equals(false);
expect(UserDTOUtils.isDirectoryPathAvailable('/abc/two', ['/'])).to.be.equals(false);
expect(UserDTOUtils.isDirectoryPathAvailable('/abc/two', ['/*'])).to.be.equals(true);
2018-02-04 02:50:42 +02:00
});
it('should check directory', () => {
expect(UserDTOUtils.isDirectoryAvailable({path: '/', name: 'abc'} as any, ['/*'])).to.be.equals(true);
expect(UserDTOUtils.isDirectoryAvailable({path: '/', name: 'abc'} as any, ['/'])).to.be.equals(false);
expect(UserDTOUtils.isDirectoryAvailable({path: '.\\', name: '.'} as any, ['/'])).to.be.equals(true);
expect(UserDTOUtils.isDirectoryAvailable({path: '/', name: 'abc'} as any, ['/*', '/asdad'])).to.be.equals(true);
2018-02-04 02:50:42 +02:00
});
});