Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created December 21, 2024 04:44
Show Gist options
  • Save YonatanKra/7c52b72d946be1b1f3ec1ac3213d72e2 to your computer and use it in GitHub Desktop.
Save YonatanKra/7c52b72d946be1b1f3ec1ac3213d72e2 to your computer and use it in GitHub Desktop.
it('should send parsed output to the callback', async () => {
queueAgentFeedResponse(fullFeedResponseWithAlt);
queueAgentFeedResponse(fullFeedLastResponse);
const spy = vi.fn();
await bot.run(handle, 'password', spy);
expect(spy.mock.calls[0][0]).toEqual({
results: [
{
imagesWithoutAlt: [],
text: 'text1',
createdAt: fullFeedResponseWithAlt.data.feed[0].post.record?.createdAt
},
{
imagesWithoutAlt: [],
text: 'text2',
createdAt: fullFeedResponseWithAlt.data.feed[1].post.record?.createdAt },
],
done: false
});
expect(spy.mock.calls[1][0]).toEqual({
results: [
{
imagesWithoutAlt: [imageWithoutAlt, imageWithoutAlt],
text: 'text1',
createdAt: fullFeedLastResponse.data.feed[0].post.record?.createdAt
},
{
imagesWithoutAlt: [imageWithoutAlt, imageWithoutAlt],
text: 'text2',
createdAt: fullFeedLastResponse.data.feed[1].post.record?.createdAt },
],
done: true
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment