Files
cocos-engine/tests/asset-manager/cache.test.ts
Santy-Wang cf3e10b6c4 sync some unit test from 2.4 (#9321)
* add unit test

* add more unit test

* refine

* add test

* add more unit test

* add more unit test

* more change

* add commit

* add unit test

* commit package-lock.json

* revert some

* refine code

* add more test

* fix bugs

* fix bugs
2021-09-13 19:05:39 +08:00

13 lines
454 B
TypeScript

import Cache from '../../cocos/core/asset-manager/cache'
test('operation', function () {
const cache = new Cache();
cache.add('test 1', {url: 'resources/image'});
expect(cache.count).toBe(1);
expect(cache.get('test 1').url).toBe('resources/image');
expect(cache.get('')).toBeFalsy();
cache.add('test 1', {url: 'resources/image2'});
expect(cache.count).toBe(1);
cache.remove('test 1');
expect(cache.count).toBe(0);
});