mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
9daf2c663c
* upgrade nodejs to 18.17.0 fix compile-native-ts fix type fix eslint fix node version on native-binding test native ci fix eslint fix jest version upgrade ts-jest fix reduce EXPECTED_CAPACITY update ccbuidl Revert "test native ci" This reverts commit 795c8c68cf7ff7f2561db4414689ad3f6aa5c1f7. # Conflicts: # scripts/native-pack-tool/package-lock.json * detect node version # Conflicts: # package.json * use engine-strict option * Update .nvmrc * Update pal/input/web/accelerometer-input.ts * fix conflict * fix compile native ts * download external in compile native ts * fix
26 lines
813 B
TypeScript
26 lines
813 B
TypeScript
|
|
import { ccclass } from '../../../cocos/core/data/decorators';
|
|
import { property } from '../../../cocos/core/data/decorators/property';
|
|
import { deserialize } from '../../../cocos/serialization/deserialize';
|
|
|
|
@ccclass('Foo')
|
|
class Foo { @property foo!: Foo | null; }
|
|
|
|
const EXPECTED_CAPACITY = 750;
|
|
|
|
test(`Deserialization capacity`, () => {
|
|
const fooSerialized = createVeryDeepFoo(EXPECTED_CAPACITY);
|
|
expect(() => deserialize(fooSerialized, undefined, undefined)).not.toThrow();
|
|
});
|
|
|
|
function createVeryDeepFoo (depth: number) {
|
|
const serializedDocument: Record<string, unknown>[] = [];
|
|
for (let i = 0; i < depth; ++i) {
|
|
serializedDocument.push({
|
|
__type__: 'Foo',
|
|
foo: i === depth - 1 ? null : { __id__: i + 1 },
|
|
});
|
|
}
|
|
return serializedDocument;
|
|
}
|