Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update message type #362

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand Down
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
Loading