A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
test(asset): watch the rejection before opening the gate that causes it
esengine7ac067b6ebb0
diff --git a/sdk/tests/registry-asset-slots.test.ts b/sdk/tests/registry-asset-slots.test.tsindex 2933671ce..e0d71aac5 100644--- a/sdk/tests/registry-asset-slots.test.ts+++ b/sdk/tests/registry-asset-slots.test.ts@@ -90,11 +90,15 @@ describe('a refresh publishes only if it is still the current one', () => {const { released, kind, finish } = gated();const slots = new RegistryAssetSlots();const acquiring = slots.acquire(kind, 'anim-clip', 'walk.esanim', ['walk.esanim']);+ // Watched before the gate opens: the acquire rejects the moment the+ // preparation lands, and a rejection nobody is holding yet is an+ // unhandled one — which would then be indistinguishable from a real leak.+ const rejects = expect(acquiring).rejects.toThrow(/released while it was loading/);slots.releaseAll();await finish(1);- await expect(acquiring).rejects.toThrow(/released while it was loading/);+ await rejects;expect(released, 'the era nobody could own kept what it took').toEqual(['walk.esanim#1:texture']);expect(slots.size).toBe(0);