Tests: attempt to reduce chance of race condition

This commit is contained in:
Lovell Fuller 2023-12-13 13:22:59 +00:00
parent 3a0c375692
commit c9e3996007

View File

@ -9,7 +9,8 @@ const sharp = require('../../');
describe('Utilities', function () {
describe('Cache', function () {
it('Can be disabled', function () {
it('Can be disabled', function (done) {
queueMicrotask(() => {
sharp.cache(false);
const cache = sharp.cache(false);
assert.strictEqual(cache.memory.current, 0);
@ -19,6 +20,8 @@ describe('Utilities', function () {
assert.strictEqual(cache.files.max, 0);
assert.strictEqual(cache.items.current, 0);
assert.strictEqual(cache.items.max, 0);
done();
});
});
it('Can be enabled with defaults', function () {
const cache = sharp.cache(true);