diff --git a/web/utils/datetime.test.ts b/web/utils/datetime.test.ts index 75bdb1f8f7..e7e00ada98 100644 --- a/web/utils/datetime.test.ts +++ b/web/utils/datetime.test.ts @@ -1,27 +1,28 @@ +import { displayDate } from './datetime' +import { isToday } from './datetime' -import { displayDate } from './datetime'; -import { isToday } from './datetime'; - -test('should return only time for today\'s timestamp', () => { - const today = new Date(); - const timestamp = today.getTime(); - const expectedTime = today.toLocaleTimeString(undefined, { +test("should return only time for today's timestamp", () => { + const today = new Date() + const timestamp = today.getTime() + const expectedTime = `${today.toLocaleDateString(undefined, { + day: '2-digit', + month: 'short', + year: 'numeric', + })}, ${today.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit', second: '2-digit', hour12: true, - }); - expect(displayDate(timestamp)).toBe(expectedTime); -}); - + })}` + expect(displayDate(timestamp / 1000)).toBe(expectedTime) +}) test('should return N/A for undefined timestamp', () => { - expect(displayDate()).toBe('N/A'); -}); - + expect(displayDate()).toBe('N/A') +}) -test('should return true for today\'s timestamp', () => { - const today = new Date(); - const timestamp = today.setHours(0, 0, 0, 0); - expect(isToday(timestamp)).toBe(true); -}); +test("should return true for today's timestamp", () => { + const today = new Date() + const timestamp = today.setHours(0, 0, 0, 0) + expect(isToday(timestamp)).toBe(true) +}) diff --git a/web/utils/threadMessageBuilder.test.ts b/web/utils/threadMessageBuilder.test.ts index 856c9ad06b..d296635e64 100644 --- a/web/utils/threadMessageBuilder.test.ts +++ b/web/utils/threadMessageBuilder.test.ts @@ -23,8 +23,8 @@ describe('ThreadMessageBuilder', () => { expect(result.thread_id).toBe(msgRequest.thread.id) expect(result.role).toBe(ChatCompletionRole.User) expect(result.status).toBe(MessageStatus.Ready) - expect(result.created).toBeDefined() - expect(result.updated).toBeDefined() + expect(result.created_at).toBeDefined() + expect(result.completed_at).toBeDefined() expect(result.object).toBe('thread.message') expect(result.content).toEqual([]) }) diff --git a/web/utils/threadMessageBuilder.ts b/web/utils/threadMessageBuilder.ts index d1aac2f842..d10ef03c40 100644 --- a/web/utils/threadMessageBuilder.ts +++ b/web/utils/threadMessageBuilder.ts @@ -29,8 +29,8 @@ export class ThreadMessageBuilder { attachments: this.attachments, role: ChatCompletionRole.User, status: MessageStatus.Ready, - created: timestamp, - updated: timestamp, + created_at: timestamp, + completed_at: timestamp, object: 'thread.message', content: this.content, }