Skip to content

Commit

Permalink
Use a cleaner test
Browse files Browse the repository at this point in the history
  • Loading branch information
gagik committed Oct 30, 2024
1 parent c9aa589 commit 698051f
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/test/suite/participant/participant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2185,15 +2185,21 @@ Schema:
throw new Error(`Unhandled message content type ${message}`);
};

expect(
messages.find((message) =>
contentIncludes(message, 'some disallowed message')
)
).to.be.undefined;

expect(
messages.find((message) => contentIncludes(message, 'ok message'))
).to.not.be.undefined;
const messageContents = messages.map((message) => {
// There may be different types for the messages' content
const content = Array.isArray(message.content)
? message.content.flatMap((sub) => sub.value).join('')
: message.content;

return content;
});

// Skip the preset prompt and check that the rest are correct.
expect(messageContents.slice(1)).deep.equal([
'give me the count of all people in the prod database',
'ok message',
'find all docs by a name example',
]);
});
});
});
Expand Down

0 comments on commit 698051f

Please sign in to comment.