use webpack for all builds
This commit is contained in:
101
packages/netlify-cms-lib-util/src/__tests__/path.spec.js
Normal file
101
packages/netlify-cms-lib-util/src/__tests__/path.spec.js
Normal file
@ -0,0 +1,101 @@
|
||||
import { fileExtensionWithSeparator, fileExtension } from '../path';
|
||||
|
||||
describe('fileExtensionWithSeparator', () => {
|
||||
it('should return the extension of a file', () => {
|
||||
expect(
|
||||
fileExtensionWithSeparator('index.html')
|
||||
).toEqual(
|
||||
'.html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the extension of a file path', () => {
|
||||
expect(
|
||||
fileExtensionWithSeparator('/src/main/index.html')
|
||||
).toEqual(
|
||||
'.html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the extension of a file path with trailing slash', () => {
|
||||
expect(
|
||||
fileExtensionWithSeparator('/src/main/index.html/')
|
||||
).toEqual(
|
||||
'.html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the extension for an extension with two ..', () => {
|
||||
expect(
|
||||
fileExtensionWithSeparator('/src/main/index..html')
|
||||
).toEqual(
|
||||
'.html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return an empty string for the parent path ..', () => {
|
||||
expect(
|
||||
fileExtensionWithSeparator('..')
|
||||
).toEqual(
|
||||
''
|
||||
);
|
||||
});
|
||||
|
||||
it('should return an empty string if the file has no extension', () => {
|
||||
expect(
|
||||
fileExtensionWithSeparator('/src/main/index')
|
||||
).toEqual(
|
||||
''
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('fileExtension', () => {
|
||||
it('should return the extension of a file', () => {
|
||||
expect(
|
||||
fileExtension('index.html')
|
||||
).toEqual(
|
||||
'html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the extension of a file path', () => {
|
||||
expect(
|
||||
fileExtension('/src/main/index.html')
|
||||
).toEqual(
|
||||
'html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the extension of a file path with trailing slash', () => {
|
||||
expect(
|
||||
fileExtension('/src/main/index.html/')
|
||||
).toEqual(
|
||||
'html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return the extension for an extension with two ..', () => {
|
||||
expect(
|
||||
fileExtension('/src/main/index..html')
|
||||
).toEqual(
|
||||
'html'
|
||||
);
|
||||
});
|
||||
|
||||
it('should return an empty string for the parent path ..', () => {
|
||||
expect(
|
||||
fileExtension('..')
|
||||
).toEqual(
|
||||
''
|
||||
);
|
||||
});
|
||||
|
||||
it('should return an empty string if the file has no extension', () => {
|
||||
expect(
|
||||
fileExtension('/src/main/index')
|
||||
).toEqual(
|
||||
''
|
||||
);
|
||||
});
|
||||
});
|
7
packages/netlify-cms-lib-util/src/index.js
Normal file
7
packages/netlify-cms-lib-util/src/index.js
Normal file
@ -0,0 +1,7 @@
|
||||
export APIError from './APIError';
|
||||
export Cursor, { CURSOR_COMPATIBILITY_SYMBOL } from './Cursor';
|
||||
export EditorialWorkflowError from './EditorialWorkflowError';
|
||||
export localForage from './localForage';
|
||||
export { resolvePath, basename, fileExtensionWithSeparator, fileExtension } from './path';
|
||||
export { filterPromises, resolvePromiseProperties, then } from './promise';
|
||||
export unsentRequest from './unsentRequest';
|
Reference in New Issue
Block a user