fixed test cases

This commit is contained in:
Anirban Kar 2024-12-03 11:28:23 +05:30
parent 9d0066a449
commit fee629d8cd
4 changed files with 25 additions and 3 deletions

View File

@ -29,6 +29,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -37,6 +38,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -96,6 +98,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -104,6 +107,7 @@ exports[`StreamingMessageParser > valid artifacts with actions > should correctl
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -112,6 +116,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -120,6 +125,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -128,6 +134,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": "bundled",
} }
`; `;
@ -136,6 +143,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": "bundled",
} }
`; `;
@ -144,6 +152,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -152,6 +161,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -160,6 +170,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -168,6 +179,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -176,6 +188,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -184,6 +197,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -192,6 +206,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -200,6 +215,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -208,6 +224,7 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;
@ -216,5 +233,6 @@ exports[`StreamingMessageParser > valid artifacts without actions > should corre
"id": "artifact_1", "id": "artifact_1",
"messageId": "message_1", "messageId": "message_1",
"title": "Some title", "title": "Some title",
"type": undefined,
} }
`; `;

View File

@ -59,7 +59,11 @@ describe('StreamingMessageParser', () => {
}, },
], ],
[ [
['Some text before <boltArti', 'fact', ' title="Some title" id="artifact_1">foo</boltArtifact> Some more text'], [
'Some text before <boltArti',
'fact',
' title="Some title" id="artifact_1" type="bundled" >foo</boltArtifact> Some more text',
],
{ {
output: 'Some text before Some more text', output: 'Some text before Some more text',
callbacks: { onArtifactOpen: 1, onArtifactClose: 1, onActionOpen: 0, onActionClose: 0 }, callbacks: { onArtifactOpen: 1, onArtifactClose: 1, onActionOpen: 0, onActionClose: 0 },

View File

@ -231,7 +231,7 @@ export class WorkbenchStore {
// TODO: what do we wanna do and how do we wanna recover from this? // TODO: what do we wanna do and how do we wanna recover from this?
} }
addArtifact({ messageId, title, id,type }: ArtifactCallbackData) { addArtifact({ messageId, title, id, type }: ArtifactCallbackData) {
const artifact = this.#getArtifact(messageId); const artifact = this.#getArtifact(messageId);
if (artifact) { if (artifact) {

View File

@ -1,5 +1,5 @@
export interface BoltArtifactData { export interface BoltArtifactData {
id: string; id: string;
title: string; title: string;
type?: string; type?: string | undefined;
} }