From 7a7e516f50d66e41d6a98ee19d1b26f68bdc26d6 Mon Sep 17 00:00:00 2001 From: kaioken Date: Thu, 19 Dec 2024 09:33:08 -0400 Subject: [PATCH] update message type --- package.json | 2 +- src/types/messages.ts | 1 + test/message.test.ts | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) 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;