diff --git a/jest.config.js b/jest.config.js index 05893dd..509234b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,6 +3,7 @@ module.exports = { testEnvironment: 'node', moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], testMatch: ['**/?(*.)+(spec|test).[tj]s?(x)'], + testTimeout: 10000, // Set timeout to 10 seconds transform: { '^.+\\.(ts|tsx)$': 'ts-jest', }, diff --git a/package.json b/package.json index cccbc13..e0814ec 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.22.6", + "version": "0.22.7", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/types/messages.ts b/src/types/messages.ts index 15fa1f0..45c7fea 100644 --- a/src/types/messages.ts +++ b/src/types/messages.ts @@ -81,6 +81,7 @@ export interface MessageInputInterface { export interface MessageUpdateInputInterface { message: string; + message_verb?: string; is_public?: number; is_deleted?: number; } diff --git a/test/message.test.ts b/test/message.test.ts index cb7a122..2beb294 100644 --- a/test/message.test.ts +++ b/test/message.test.ts @@ -20,6 +20,30 @@ describe('Test the Social Messages', () => { expect(newMessage.message).toBe(messageContent); }); + it('update a message', async () => { + const client = getClient(); + const messages = client.messages; + const messageContent = 'Hello, Kanvas!'; + const newMessage = await messages.createMessage({ + message_verb: 'post', + message: messageContent, + }); + + expect(newMessage).toBeDefined(); + expect(newMessage.id).toBeDefined(); + expect(newMessage.message).toBe(messageContent); + + const updatedMessage = await messages.updateMessage(newMessage.id, { + message: 'Hello, Kanvas! Updated', + message_verb: 'post2', + }); + + expect(updatedMessage).toBeDefined(); + expect(updatedMessage.id).toBeDefined(); + expect(updatedMessage.message).toBe('Hello, Kanvas! Updated'); + expect(updatedMessage.message_types_id).not.toBe(newMessage.message_types_id); + }); + it('create a message with parent id', async () => { const client = getClient(); const messages = client.messages;