-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): add maxCacheSize field in nx.json
- Loading branch information
1 parent
a1aeb1e
commit 86edfe6
Showing
9 changed files
with
264 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { parseMaxCacheSize } from './cache'; | ||
|
||
describe('cache', () => { | ||
describe('parseMaxCacheSize', () => { | ||
it('should parse KB', () => { | ||
expect(parseMaxCacheSize('1KB')).toEqual(1024); | ||
}); | ||
|
||
it('should parse MB', () => { | ||
expect(parseMaxCacheSize('1MB')).toEqual(1024 * 1024); | ||
}); | ||
|
||
it('should parse GB', () => { | ||
expect(parseMaxCacheSize('1GB')).toEqual(1024 * 1024 * 1024); | ||
}); | ||
|
||
it('should parse B', () => { | ||
expect(parseMaxCacheSize('1B')).toEqual(1); | ||
}); | ||
|
||
it('should parse as bytes by default', () => { | ||
expect(parseMaxCacheSize('1')).toEqual(1); | ||
}); | ||
|
||
it('should handle decimals', () => { | ||
expect(parseMaxCacheSize('1.5KB')).toEqual(1024 * 1.5); | ||
}); | ||
|
||
it('should error if invalid unit', () => { | ||
expect(() => parseMaxCacheSize('1ZB')).toThrow(); | ||
}); | ||
|
||
it('should error if invalid number', () => { | ||
expect(() => parseMaxCacheSize('abc')).toThrow(); | ||
}); | ||
|
||
it('should error if multiple decimal points', () => { | ||
expect(() => parseMaxCacheSize('1.5.5KB')).toThrow; | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters