From 484cc6326bb45f2494395dacaea1c1678cd02d82 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 30 Jan 2020 20:12:43 +0100 Subject: [PATCH] modify transferOwnership integration test --- test/integration/ocean/AssetOwners.test.ts | 14 ++++++++++---- test/integration/utils/ddo-metadata-generator.ts | 1 - 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/test/integration/ocean/AssetOwners.test.ts b/test/integration/ocean/AssetOwners.test.ts index 798971c..c48f884 100644 --- a/test/integration/ocean/AssetOwners.test.ts +++ b/test/integration/ocean/AssetOwners.test.ts @@ -102,12 +102,18 @@ describe('Asset Owners', () => { }) it('should be able to transfer ownership', async () => { - const { id } = await ocean.assets.create(metadata as any, account1) + const ddo = await ocean.assets.create(metadata as any, account1) + const newOwner = account2.getId() // transfer - await ocean.assets.transferOwnership(id, account2.getId()) - const newOwner = await ocean.keeper.didRegistry.getDIDOwner(id) + await ocean.assets.transferOwnership(ddo.id, newOwner) - assert.equal(newOwner, account2.getId()) + // check owner change on-chain + const newOwnerChain = await ocean.keeper.didRegistry.getDIDOwner(ddo.id) + assert.equal(newOwnerChain, newOwner) + + // check owner change off-chain + const newOwnerDdo = await ocean.assets.owner(ddo.id) + assert.equal(newOwnerDdo, newOwner) }) }) diff --git a/test/integration/utils/ddo-metadata-generator.ts b/test/integration/utils/ddo-metadata-generator.ts index ed488e4..94bb8c2 100644 --- a/test/integration/utils/ddo-metadata-generator.ts +++ b/test/integration/utils/ddo-metadata-generator.ts @@ -47,7 +47,6 @@ const metadata: Partial = { } export const generateMetadata = (name: string, price?: number): Partial => ({ - ...metadata, main: { ...metadata.main, name,