Skip to content

Commit

Permalink
update message type
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken committed Dec 19, 2024
1 parent 8b3dc96 commit 7a7e516
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.22.6",
"version": "0.22.7",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
1 change: 1 addition & 0 deletions src/types/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export interface MessageInputInterface {

export interface MessageUpdateInputInterface {
message: string;
message_verb?: string;
is_public?: number;
is_deleted?: number;
}
Expand Down
24 changes: 24 additions & 0 deletions test/message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7a7e516

Please sign in to comment.