diff --git a/examples/__tests__/test-clean-state.ava.js b/examples/__tests__/test-clean-state.ava.js index bb717976..31f5e07c 100644 --- a/examples/__tests__/test-clean-state.ava.js +++ b/examples/__tests__/test-clean-state.ava.js @@ -19,7 +19,7 @@ test.beforeEach(async t => { }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed tear down the worker:', error); }); diff --git a/examples/__tests__/test-counter.ava.js b/examples/__tests__/test-counter.ava.js index ca1bb26d..8a696480 100644 --- a/examples/__tests__/test-counter.ava.js +++ b/examples/__tests__/test-counter.ava.js @@ -26,7 +26,7 @@ test.beforeEach(async t => { }); // If the environment is reused, use test.after to replace test.afterEach -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/examples/__tests__/test-cross-contract-call.ava.js b/examples/__tests__/test-cross-contract-call.ava.js index d0b7c075..4b366698 100644 --- a/examples/__tests__/test-cross-contract-call.ava.js +++ b/examples/__tests__/test-cross-contract-call.ava.js @@ -36,7 +36,7 @@ test.beforeEach(async t => { }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed tear down the worker:', error); }); diff --git a/examples/__tests__/test-fungible-token-lockable.ava.js b/examples/__tests__/test-fungible-token-lockable.ava.js index 39350e8b..5481f8b2 100644 --- a/examples/__tests__/test-fungible-token-lockable.ava.js +++ b/examples/__tests__/test-fungible-token-lockable.ava.js @@ -25,7 +25,7 @@ test.beforeEach(async t => { t.context.accounts = { root, lockableFt, ali, bob }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/examples/__tests__/test-fungible-token.ava.js b/examples/__tests__/test-fungible-token.ava.js index 6e147449..7cab26de 100644 --- a/examples/__tests__/test-fungible-token.ava.js +++ b/examples/__tests__/test-fungible-token.ava.js @@ -28,7 +28,7 @@ test.beforeEach(async (t) => { t.context.accounts = { root, ft, ali, bob, xcc }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed tear down the worker:', error); }); diff --git a/examples/__tests__/test-non-fungible-token.ava.js b/examples/__tests__/test-non-fungible-token.ava.js index f143774c..6f897050 100644 --- a/examples/__tests__/test-non-fungible-token.ava.js +++ b/examples/__tests__/test-non-fungible-token.ava.js @@ -38,7 +38,7 @@ test.beforeEach(async t => { t.context.accounts = { root, nft, tokenReceiver, tokenId, ali, bob }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed tear down the worker:', error); }); diff --git a/examples/__tests__/test-parking-lot.ava.js b/examples/__tests__/test-parking-lot.ava.js index f2e755fc..af1d3b3a 100644 --- a/examples/__tests__/test-parking-lot.ava.js +++ b/examples/__tests__/test-parking-lot.ava.js @@ -16,7 +16,7 @@ test.beforeEach(async t => { t.context.accounts = { root, parkingLot, ali }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/examples/__tests__/test-status-message-collections.ava.js b/examples/__tests__/test-status-message-collections.ava.js index b13056cf..ab1ba23a 100644 --- a/examples/__tests__/test-status-message-collections.ava.js +++ b/examples/__tests__/test-status-message-collections.ava.js @@ -24,7 +24,7 @@ test.beforeEach(async t => { t.context.accounts = { root, statusMessage, ali, bob, carl }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/examples/__tests__/test-status-message.ava.js b/examples/__tests__/test-status-message.ava.js index 28dd92f5..9310cf02 100644 --- a/examples/__tests__/test-status-message.ava.js +++ b/examples/__tests__/test-status-message.ava.js @@ -23,7 +23,7 @@ test.before(async t => { t.context.accounts = { root, statusMessage, ali, bob, carl }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/lib/collections/lookup-map.d.ts b/lib/collections/lookup-map.d.ts index ce306dc2..8ab995da 100644 --- a/lib/collections/lookup-map.d.ts +++ b/lib/collections/lookup-map.d.ts @@ -8,5 +8,5 @@ export declare class LookupMap { set(key: Bytes, value: unknown): unknown | null; extend(objects: [Bytes, unknown][]): void; serialize(): string; - static deserialize(data: LookupMap): LookupMap; + static reconstruct(data: LookupMap): LookupMap; } diff --git a/lib/collections/lookup-map.js b/lib/collections/lookup-map.js index ed0b5f47..837a4640 100644 --- a/lib/collections/lookup-map.js +++ b/lib/collections/lookup-map.js @@ -39,7 +39,7 @@ export class LookupMap { return JSON.stringify(this); } // converting plain object to class object - static deserialize(data) { + static reconstruct(data) { return new LookupMap(data.keyPrefix); } } diff --git a/lib/collections/lookup-set.d.ts b/lib/collections/lookup-set.d.ts index 36af50dc..d8f3ef5e 100644 --- a/lib/collections/lookup-set.d.ts +++ b/lib/collections/lookup-set.d.ts @@ -7,5 +7,5 @@ export declare class LookupSet { set(key: Bytes): boolean; extend(keys: Bytes[]): void; serialize(): string; - static deserialize(data: LookupSet): LookupSet; + static reconstruct(data: LookupSet): LookupSet; } diff --git a/lib/collections/lookup-set.js b/lib/collections/lookup-set.js index aa80dd1f..9ba56dba 100644 --- a/lib/collections/lookup-set.js +++ b/lib/collections/lookup-set.js @@ -27,7 +27,7 @@ export class LookupSet { return JSON.stringify(this); } // converting plain object to class object - static deserialize(data) { + static reconstruct(data) { return new LookupSet(data.keyPrefix); } } diff --git a/lib/collections/unordered-map.d.ts b/lib/collections/unordered-map.d.ts index 60e02e95..76995b58 100644 --- a/lib/collections/unordered-map.d.ts +++ b/lib/collections/unordered-map.d.ts @@ -16,7 +16,7 @@ export declare class UnorderedMap { [Symbol.iterator](): UnorderedMapIterator; extend(kvs: [Bytes, unknown][]): void; serialize(): string; - static deserialize(data: UnorderedMap): UnorderedMap; + static reconstruct(data: UnorderedMap): UnorderedMap; } declare class UnorderedMapIterator { private keys; diff --git a/lib/collections/unordered-map.js b/lib/collections/unordered-map.js index e99436b3..070f74e6 100644 --- a/lib/collections/unordered-map.js +++ b/lib/collections/unordered-map.js @@ -83,7 +83,7 @@ export class UnorderedMap { return JSON.stringify(this); } // converting plain object to class object - static deserialize(data) { + static reconstruct(data) { let map = new UnorderedMap(data.prefix); // reconstruct keys Vector map.keys = new Vector(data.prefix + "u"); diff --git a/lib/collections/unordered-set.d.ts b/lib/collections/unordered-set.d.ts index 1cdf48b6..b7de5f03 100644 --- a/lib/collections/unordered-set.d.ts +++ b/lib/collections/unordered-set.d.ts @@ -15,5 +15,5 @@ export declare class UnorderedSet { [Symbol.iterator](): import("./vector").VectorIterator; extend(elements: unknown[]): void; serialize(): string; - static deserialize(data: UnorderedSet): UnorderedSet; + static reconstruct(data: UnorderedSet): UnorderedSet; } diff --git a/lib/collections/unordered-set.js b/lib/collections/unordered-set.js index 948bb67f..581f8f5c 100644 --- a/lib/collections/unordered-set.js +++ b/lib/collections/unordered-set.js @@ -98,7 +98,7 @@ export class UnorderedSet { return JSON.stringify(this); } // converting plain object to class object - static deserialize(data) { + static reconstruct(data) { let set = new UnorderedSet(data.prefix); // reconstruct Vector let elementsPrefix = data.prefix + "e"; diff --git a/lib/collections/vector.d.ts b/lib/collections/vector.d.ts index 406e6d6c..70e5a54b 100644 --- a/lib/collections/vector.d.ts +++ b/lib/collections/vector.d.ts @@ -14,7 +14,7 @@ export declare class Vector { clear(): void; toArray(): unknown[]; serialize(): string; - static deserialize(data: Vector): Vector; + static reconstruct(data: Vector): Vector; } export declare class VectorIterator { private current; diff --git a/lib/collections/vector.js b/lib/collections/vector.js index ebed23d2..e9548621 100644 --- a/lib/collections/vector.js +++ b/lib/collections/vector.js @@ -107,7 +107,7 @@ export class Vector { return JSON.stringify(this); } // converting plain object to class object - static deserialize(data) { + static reconstruct(data) { let vector = new Vector(data.prefix); vector.length = data.length; return vector; diff --git a/lib/near-bindgen.js b/lib/near-bindgen.js index d266db78..2aae629f 100644 --- a/lib/near-bindgen.js +++ b/lib/near-bindgen.js @@ -45,8 +45,8 @@ export function NearBindgen({ requireInit = false }) { } static _reconstruct(classObject, plainObject) { for (const item in classObject) { - if (classObject[item].constructor?.deserialize !== undefined) { - classObject[item] = classObject[item].constructor.deserialize(plainObject[item]); + if (classObject[item].constructor?.reconstruct !== undefined) { + classObject[item] = classObject[item].constructor.reconstruct(plainObject[item]); } else { classObject[item] = plainObject[item]; diff --git a/src/collections/lookup-map.ts b/src/collections/lookup-map.ts index 60c33437..b934adb2 100644 --- a/src/collections/lookup-map.ts +++ b/src/collections/lookup-map.ts @@ -50,7 +50,7 @@ export class LookupMap { } // converting plain object to class object - static deserialize(data: LookupMap): LookupMap { + static reconstruct(data: LookupMap): LookupMap { return new LookupMap(data.keyPrefix) } } \ No newline at end of file diff --git a/src/collections/lookup-set.ts b/src/collections/lookup-set.ts index 5157f46a..e8927e21 100644 --- a/src/collections/lookup-set.ts +++ b/src/collections/lookup-set.ts @@ -37,7 +37,7 @@ export class LookupSet { } // converting plain object to class object - static deserialize(data: LookupSet): LookupSet { + static reconstruct(data: LookupSet): LookupSet { return new LookupSet(data.keyPrefix) } } \ No newline at end of file diff --git a/src/collections/unordered-map.ts b/src/collections/unordered-map.ts index ae60e2b0..dcd8a681 100644 --- a/src/collections/unordered-map.ts +++ b/src/collections/unordered-map.ts @@ -106,7 +106,7 @@ export class UnorderedMap { } // converting plain object to class object - static deserialize(data: UnorderedMap): UnorderedMap { + static reconstruct(data: UnorderedMap): UnorderedMap { // removing readonly modifier type MutableUnorderedMap = Mutable; let map = new UnorderedMap(data.prefix) as MutableUnorderedMap; diff --git a/src/collections/unordered-set.ts b/src/collections/unordered-set.ts index 49c0ca82..5f72180c 100644 --- a/src/collections/unordered-set.ts +++ b/src/collections/unordered-set.ts @@ -117,7 +117,7 @@ export class UnorderedSet { } // converting plain object to class object - static deserialize(data: UnorderedSet): UnorderedSet { + static reconstruct(data: UnorderedSet): UnorderedSet { // removing readonly modifier type MutableUnorderedSet = Mutable; let set = new UnorderedSet(data.prefix) as MutableUnorderedSet; diff --git a/src/collections/vector.ts b/src/collections/vector.ts index ef102be4..d7036a65 100644 --- a/src/collections/vector.ts +++ b/src/collections/vector.ts @@ -119,7 +119,7 @@ export class Vector { } // converting plain object to class object - static deserialize(data: Vector): Vector { + static reconstruct(data: Vector): Vector { let vector = new Vector(data.prefix); vector.length = data.length; return vector; diff --git a/src/near-bindgen.ts b/src/near-bindgen.ts index 9b9d40f8..543eef89 100644 --- a/src/near-bindgen.ts +++ b/src/near-bindgen.ts @@ -55,8 +55,8 @@ export function NearBindgen({ requireInit = false }: { requireInit?: boolean }) static _reconstruct(classObject: any, plainObject: JSON) { for (const item in classObject) { - if (classObject[item].constructor?.deserialize !== undefined) { - classObject[item] = classObject[item].constructor.deserialize(plainObject[item]) + if (classObject[item].constructor?.reconstruct !== undefined) { + classObject[item] = classObject[item].constructor.reconstruct(plainObject[item]) } else { classObject[item] = plainObject[item] } diff --git a/tests/__tests__/bytes.ava.js b/tests/__tests__/bytes.ava.js index 53146759..af0964d6 100644 --- a/tests/__tests__/bytes.ava.js +++ b/tests/__tests__/bytes.ava.js @@ -20,7 +20,7 @@ test.beforeEach(async t => { t.context.accounts = { root, bytesContract, ali }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/decorators/near_bindgen.ava.js b/tests/__tests__/decorators/near_bindgen.ava.js index 03169ff8..048e813e 100644 --- a/tests/__tests__/decorators/near_bindgen.ava.js +++ b/tests/__tests__/decorators/near_bindgen.ava.js @@ -19,7 +19,7 @@ test.beforeEach(async t => { }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/decorators/payable.ava.js b/tests/__tests__/decorators/payable.ava.js index 44c3c294..8b2833e4 100644 --- a/tests/__tests__/decorators/payable.ava.js +++ b/tests/__tests__/decorators/payable.ava.js @@ -19,7 +19,7 @@ test.beforeEach(async t => { }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/decorators/private.ava.js b/tests/__tests__/decorators/private.ava.js index 69b4fa50..14f675ca 100644 --- a/tests/__tests__/decorators/private.ava.js +++ b/tests/__tests__/decorators/private.ava.js @@ -17,7 +17,7 @@ test.beforeEach(async t => { }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/function-params.ava.js b/tests/__tests__/function-params.ava.js index b86071be..01cb0555 100644 --- a/tests/__tests__/function-params.ava.js +++ b/tests/__tests__/function-params.ava.js @@ -23,7 +23,7 @@ test.before(async t => { t.context.accounts = { root, functionParamsContract, ali, bob, carl }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/lookup-map.ava.js b/tests/__tests__/lookup-map.ava.js index 45a6b870..2cc8b471 100644 --- a/tests/__tests__/lookup-map.ava.js +++ b/tests/__tests__/lookup-map.ava.js @@ -23,7 +23,7 @@ test.beforeEach(async t => { t.context.accounts = { root, lookupMapContract, ali, bob, carl }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/lookup-set.ava.js b/tests/__tests__/lookup-set.ava.js index 166b34e5..4e2a2024 100644 --- a/tests/__tests__/lookup-set.ava.js +++ b/tests/__tests__/lookup-set.ava.js @@ -22,7 +22,7 @@ test.beforeEach(async t => { t.context.accounts = { root, lookupSetContract, ali, bob, carl }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test-public-key.ava.js b/tests/__tests__/test-public-key.ava.js index 6c576b53..36d5aa68 100644 --- a/tests/__tests__/test-public-key.ava.js +++ b/tests/__tests__/test-public-key.ava.js @@ -23,7 +23,7 @@ test.before(async t => { t.context.accounts = { root, pkContract, ali, bob, carl }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test_context_api.ava.js b/tests/__tests__/test_context_api.ava.js index 8ff41c07..a2517d44 100644 --- a/tests/__tests__/test_context_api.ava.js +++ b/tests/__tests__/test_context_api.ava.js @@ -24,7 +24,7 @@ test.before(async t => { t.context.accounts = { root, contextApiContract, ali, bob, carl }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test_highlevel_promise.ava.js b/tests/__tests__/test_highlevel_promise.ava.js index 57c0544b..d732f96a 100644 --- a/tests/__tests__/test_highlevel_promise.ava.js +++ b/tests/__tests__/test_highlevel_promise.ava.js @@ -25,7 +25,7 @@ test.before(async t => { t.context.accounts = { root, highlevelPromise, ali, bob, calleeContract }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test_log_panic_api.ava.js b/tests/__tests__/test_log_panic_api.ava.js index 59700165..14a60584 100644 --- a/tests/__tests__/test_log_panic_api.ava.js +++ b/tests/__tests__/test_log_panic_api.ava.js @@ -22,7 +22,7 @@ test.before(async t => { t.context.accounts = { root, testContract, ali }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test_math_api.ava.js b/tests/__tests__/test_math_api.ava.js index ec04bd99..9f2fdaee 100644 --- a/tests/__tests__/test_math_api.ava.js +++ b/tests/__tests__/test_math_api.ava.js @@ -21,7 +21,7 @@ test.before(async t => { t.context.accounts = { root, mathApiContract, ali }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test_promise_api.ava.js b/tests/__tests__/test_promise_api.ava.js index 7c836dc6..3dec7def 100644 --- a/tests/__tests__/test_promise_api.ava.js +++ b/tests/__tests__/test_promise_api.ava.js @@ -30,7 +30,7 @@ test.before(async t => { t.context.accounts = { root, callerContract, calleeContract, ali, bob, caller2Contract }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/test_storage_api.ava.js b/tests/__tests__/test_storage_api.ava.js index 3b91110b..88a7d2d4 100644 --- a/tests/__tests__/test_storage_api.ava.js +++ b/tests/__tests__/test_storage_api.ava.js @@ -22,7 +22,7 @@ test.beforeEach(async t => { t.context.accounts = { root, storageApiContract, ali }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/typescript.ava.js b/tests/__tests__/typescript.ava.js index a6a327bc..dbdf5e49 100644 --- a/tests/__tests__/typescript.ava.js +++ b/tests/__tests__/typescript.ava.js @@ -20,7 +20,7 @@ test.before(async t => { t.context.accounts = { root, typescriptContract, ali }; }); -test.after(async t => { +test.after.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/unordered-map.ava.js b/tests/__tests__/unordered-map.ava.js index 8608c495..c3e532ef 100644 --- a/tests/__tests__/unordered-map.ava.js +++ b/tests/__tests__/unordered-map.ava.js @@ -22,7 +22,7 @@ test.beforeEach(async t => { t.context.accounts = { root, unorderedMapContract, ali, bob, carl }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/unordered-set.ava.js b/tests/__tests__/unordered-set.ava.js index a7317672..a42fae7d 100644 --- a/tests/__tests__/unordered-set.ava.js +++ b/tests/__tests__/unordered-set.ava.js @@ -23,7 +23,7 @@ test.beforeEach(async t => { t.context.accounts = { root, unorderedSetContract, ali, bob, carl }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); }); diff --git a/tests/__tests__/vector.ava.js b/tests/__tests__/vector.ava.js index 0dc0ab1f..d805c97b 100644 --- a/tests/__tests__/vector.ava.js +++ b/tests/__tests__/vector.ava.js @@ -23,7 +23,7 @@ test.beforeEach(async t => { t.context.accounts = { root, vectorContract, ali, bob, carl }; }); -test.afterEach(async t => { +test.afterEach.always(async t => { await t.context.worker.tearDown().catch(error => { console.log('Failed to tear down the worker:', error); });