1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/test/common/unit/UserDTO.ts

27 lines
1.3 KiB
TypeScript
Raw Normal View History

2018-03-31 03:30:30 +08:00
import {expect} from 'chai';
2019-12-10 17:44:35 +08:00
import {UserDTO} from '../../../src/common/entities/UserDTO';
2018-02-04 08:50:42 +08:00
describe('UserDTO', () => {
it('should check available path', () => {
2019-02-23 06:39:01 +08:00
expect(UserDTO.isDirectoryPathAvailable('/', ['/'])).to.be.equals(true);
expect(UserDTO.isDirectoryPathAvailable('/', ['/subfolder', '/'])).to.be.equals(true);
expect(UserDTO.isDirectoryPathAvailable('/abc', ['/subfolder', '/'])).to.be.equals(false);
expect(UserDTO.isDirectoryPathAvailable('/abc', ['/subfolder', '/*'])).to.be.equals(true);
expect(UserDTO.isDirectoryPathAvailable('/abc', ['/subfolder'])).to.be.equals(false);
expect(UserDTO.isDirectoryPathAvailable('/abc/two', ['/subfolder'])).to.be.equals(false);
expect(UserDTO.isDirectoryPathAvailable('/abc/two', ['/'])).to.be.equals(false);
expect(UserDTO.isDirectoryPathAvailable('/abc/two', ['/*'])).to.be.equals(true);
2018-02-04 08:50:42 +08:00
});
it('should check directory', () => {
2018-03-31 03:30:30 +08:00
expect(UserDTO.isDirectoryAvailable(<any>{path: '/', name: 'abc'}, ['/*'])).to.be.equals(true);
expect(UserDTO.isDirectoryAvailable(<any>{path: '/', name: 'abc'}, ['/'])).to.be.equals(false);
expect(UserDTO.isDirectoryAvailable(<any>{path: '.\\', name: '.'}, ['/'])).to.be.equals(true);
expect(UserDTO.isDirectoryAvailable(<any>{path: '/', name: 'abc'}, ['/*', '/asdad'])).to.be.equals(true);
2018-02-04 08:50:42 +08:00
});
});