diff --git a/__tests__/integration/core-api/handlers/locks.test.ts b/__tests__/integration/core-api/handlers/locks.test.ts index 19d8916b71..7147d000bb 100644 --- a/__tests__/integration/core-api/handlers/locks.test.ts +++ b/__tests__/integration/core-api/handlers/locks.test.ts @@ -215,7 +215,9 @@ describe("API 2.0 - Locks", () => { const lock = response.data.data[0]; api.expectLock(lock); - expect(lock.timestamp).toBe(5000); + expect(lock.timestamp.unix).toBe(1490106200); + expect(lock.timestamp.epoch).toBe(5000); + expect(lock.timestamp.human).toBe("2017-03-21T14:23:20.000Z"); }); }); diff --git a/__tests__/integration/core-api/handlers/wallets.test.ts b/__tests__/integration/core-api/handlers/wallets.test.ts index c1f451c4d5..148d62ddbb 100644 --- a/__tests__/integration/core-api/handlers/wallets.test.ts +++ b/__tests__/integration/core-api/handlers/wallets.test.ts @@ -181,6 +181,7 @@ describe("API 2.0 - Wallets", () => { type: j % 2 === 0 ? 1 : 2, value: 100 * (j + 1), }, + timestamp: 0, }; } diff --git a/packages/core-api/src/resources/lock.ts b/packages/core-api/src/resources/lock.ts index bc0481db3c..8cc7c77185 100644 --- a/packages/core-api/src/resources/lock.ts +++ b/packages/core-api/src/resources/lock.ts @@ -1,4 +1,4 @@ -import { Container } from "@arkecosystem/core-kernel"; +import { Container, Utils } from "@arkecosystem/core-kernel"; import { Resource } from "../interfaces"; @@ -26,6 +26,7 @@ export class LockResource implements Resource { return { ...resource, amount: resource.amount.toFixed(), + timestamp: Utils.formatTimestamp(resource.timestamp), }; } } diff --git a/packages/core-test-framework/src/utils/api.ts b/packages/core-test-framework/src/utils/api.ts index 73fe0f7066..c15f52bff3 100644 --- a/packages/core-test-framework/src/utils/api.ts +++ b/packages/core-test-framework/src/utils/api.ts @@ -162,9 +162,12 @@ export class ApiHelpers { expect(lock).toHaveProperty("recipientId"); expect(lock).toHaveProperty("amount"); expect(lock).toHaveProperty("secretHash"); - expect(lock).toHaveProperty("timestamp"); expect(lock).toHaveProperty("expirationType"); expect(lock).toHaveProperty("expirationValue"); + expect(lock.timestamp).toBeObject(); + expect(lock.timestamp.epoch).toBeNumber(); + expect(lock.timestamp.unix).toBeNumber(); + expect(lock.timestamp.human).toBeString(); } // todo: fix the use of the factory