mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 15:36:33 +00:00
fix(ci): card points re-typed for the non-strict builds, formatting, strict ratchet and two assistant e2e checks
This commit is contained in:
@@ -1131,9 +1131,10 @@ describe('Trip assistant e2e', () => {
|
||||
const args = { question, options: ['Trattoria', 'Night market'] };
|
||||
provider.script = [callTools({ id: 'call_poll', name: 'create_collab_poll', args })];
|
||||
const turn = await post(`${t.base}/chat`, t.userId, { ...CTX, threadId: null, text: 'Ask the group' });
|
||||
const toolCallId = ofType(turn.chunks, 'tool-approval-request')[0]?.toolCallId ?? '';
|
||||
const [change] = ofType(turn.chunks, 'data-trek-change');
|
||||
expect(change.data).toMatchObject({
|
||||
toolCallId: 'call_poll',
|
||||
toolCallId,
|
||||
verbKey: 'genericCreate',
|
||||
tool: 'create_collab_poll',
|
||||
domain: 'collab',
|
||||
@@ -1148,7 +1149,7 @@ describe('Trip assistant e2e', () => {
|
||||
provider.script = [say('The poll is up.')];
|
||||
const decided = await post(`${t.base}/threads/${threadId}/decisions`, t.userId, {
|
||||
...CTX,
|
||||
decisions: [{ toolCallId: 'call_poll', approved: true }],
|
||||
decisions: [{ toolCallId, approved: true }],
|
||||
});
|
||||
expect(decided.status).toBe(200);
|
||||
const poll = await findRow(orm, CollabPolls, { trip: t.tripId });
|
||||
@@ -1156,7 +1157,7 @@ describe('Trip assistant e2e', () => {
|
||||
const [applied] = ofType(decided.chunks, 'data-trek-applied');
|
||||
expect(applied.data).toMatchObject({ entity: 'collab_poll', ids: [poll?.id] });
|
||||
expect(ofType(decided.chunks, 'data-trek-card')[0].data).toMatchObject({
|
||||
toolCallId: 'call_poll',
|
||||
toolCallId,
|
||||
card: { kind: 'collabPolls', polls: [{ pollId: poll?.id, change: 'create', question }] },
|
||||
});
|
||||
expect(broadcasts.broadcast).toHaveBeenCalledWith(t.tripId, 'collab:poll:created', expect.anything());
|
||||
|
||||
@@ -222,7 +222,14 @@ describe('answer cards', () => {
|
||||
it('ASTCARD-BUD-004: an empty list, a broken answer and rows without a name or an amount show no card', () => {
|
||||
expect(answer('list_budget_items', { currency: 'EUR', total: 0, items: [] })).toBeNull();
|
||||
expect(answer('list_budget_items', 'not a list')).toBeNull();
|
||||
expect(answer('list_budget_items', { items: [{ id: 1, total_price: 5 }, { id: 2, name: 'Tip' }] })).toBeNull();
|
||||
expect(
|
||||
answer('list_budget_items', {
|
||||
items: [
|
||||
{ id: 1, total_price: 5 },
|
||||
{ id: 2, name: 'Tip' },
|
||||
],
|
||||
}),
|
||||
).toBeNull();
|
||||
expect(answer('get_settlement_summary', { error: 'nope' })).toBeNull();
|
||||
expect(answer('get_budget_per_person', { summary: [] })).toBeNull();
|
||||
expect(answer('list_settlements', { settlements: [] })).toBeNull();
|
||||
|
||||
@@ -143,7 +143,14 @@ describe('the chat card of a read', () => {
|
||||
const row = message(4, {
|
||||
origin: 'assistant',
|
||||
reactions: [
|
||||
{ emoji: '❤️', count: 2, users: [{ user_id: 7, username: 'anna' }, { user_id: 8, username: 'jon' }] },
|
||||
{
|
||||
emoji: '❤️',
|
||||
count: 2,
|
||||
users: [
|
||||
{ user_id: 7, username: 'anna' },
|
||||
{ user_id: 8, username: 'jon' },
|
||||
],
|
||||
},
|
||||
{ emoji: '👍', count: 1, users: [{ user_id: 8, username: 'jon' }] },
|
||||
],
|
||||
attachments: [
|
||||
|
||||
@@ -195,7 +195,12 @@ describe('collection change cards', () => {
|
||||
const deleted = preview('delete_collection', { collectionId: 12 }, { collection });
|
||||
expect(deleted).toMatchObject({ subject: 'Paris food', verbKey: 'genericRemove' });
|
||||
expect(listsOf(deleted.card).lists[0]).toMatchObject({ placeCount: 10, memberCount: 1, change: 'remove' });
|
||||
const lists = { collections: [{ id: 12, name: 'A' }, { id: 13, name: 'B' }] };
|
||||
const lists = {
|
||||
collections: [
|
||||
{ id: 12, name: 'A' },
|
||||
{ id: 13, name: 'B' },
|
||||
],
|
||||
};
|
||||
const order = preview('reorder_collections', { orderedIds: [13, 12] }, { lists });
|
||||
expect(order.subject).toBe('B, A');
|
||||
expect(listsOf(order.card).lists.map((row) => [row.name, row.change])).toEqual([
|
||||
|
||||
@@ -342,7 +342,17 @@ describe('the words and the way back of the other tour writes', () => {
|
||||
expect(unchangedSinceApplied('create_hike', created, onItsDay)).toBe(true);
|
||||
const twice = {
|
||||
places: { places: [hike] },
|
||||
summary: { days: [{ id: 31, assignments: [{ id: 306, place_id: 64 }, { id: 305, place_id: 64 }] }] },
|
||||
summary: {
|
||||
days: [
|
||||
{
|
||||
id: 31,
|
||||
assignments: [
|
||||
{ id: 306, place_id: 64 },
|
||||
{ id: 305, place_id: 64 },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
expect(unchangedSinceApplied('create_hike', created, twice)).toBe(false);
|
||||
// A new way saved since (any route write stamps updated_at) keeps the tour, name and day unchanged or not.
|
||||
|
||||
@@ -13,13 +13,7 @@ import type { AnswerInput } from '../../../../../../src/nest/assistant/cards/car
|
||||
import { answerCardOf } from '../../../../../../src/nest/assistant/cards/registry';
|
||||
import { fitted, hardestStretches } from '../../../../../../src/nest/assistant/cards/tour/tour-card-values';
|
||||
import { sacStretches } from '../../../../../../src/nest/assistant/cards/tour/tour-route.cards';
|
||||
import {
|
||||
MAX_CARD_CHARS,
|
||||
trekCardSchema,
|
||||
type TourRouteCard,
|
||||
type TourRouteStretch,
|
||||
type TrekCard,
|
||||
} from '@trek/shared';
|
||||
import { MAX_CARD_CHARS, trekCardSchema, type TourRouteCard, type TourRouteStretch, type TrekCard } from '@trek/shared';
|
||||
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user