Skip to content

Commit 3a8de6d

Browse files
committed
feat(condo): DOMA-13253 fix tests
1 parent adf68e1 commit 3a8de6d

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

apps/condo/domains/ai/schema/ExecutionAIFlowTask.test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,10 @@ describe('ExecutionAIFlowTask', () => {
538538

539539
describe('Attachments validation', () => {
540540
test('chat-with-condo context accepts attachments metadata without url', async () => {
541-
const [task] = await createTestExecutionAIFlowTask(adminClient, userClient.user, {
541+
const task = await ExecutionAIFlowTaskForUser.create(userClient, {
542+
dv: 1,
543+
sender: { fingerprint: faker.random.alphaNumeric(8), dv: 1 },
544+
user: { connect: { id: userClient.user.id } },
542545
flowType: CHAT_WITH_CONDO_FLOW_TYPE,
543546
context: {
544547
userInput: 'test',
@@ -554,15 +557,16 @@ describe('ExecutionAIFlowTask', () => {
554557
}],
555558
},
556559
})
560+
const foundTask = await ExecutionAIFlowTask.getOne(adminClient, { id: task.id })
557561

558562
expect(task.context.attachments).toHaveLength(1)
559563
expect(task.context.attachments[0]).not.toHaveProperty('url')
560-
expect(task.cleanContext.attachments[0]).not.toHaveProperty('url')
564+
expect(foundTask.cleanContext.attachments[0]).not.toHaveProperty('url')
561565
})
562566

563567
test('chat-with-condo rejects attachment with url in client context', async () => {
564568
await expectToThrowGQLError(async () => {
565-
await createTestExecutionAIFlowTask(adminClient, userClient.user, {
569+
await createTestExecutionAIFlowTask(userClient, userClient.user, {
566570
flowType: CHAT_WITH_CONDO_FLOW_TYPE,
567571
context: {
568572
userInput: 'test',
@@ -586,7 +590,7 @@ describe('ExecutionAIFlowTask', () => {
586590

587591
test('chat-with-condo rejects unsupported attachment mimeType', async () => {
588592
await expectToThrowGQLError(async () => {
589-
await createTestExecutionAIFlowTask(adminClient, userClient.user, {
593+
await createTestExecutionAIFlowTask(userClient, userClient.user, {
590594
flowType: CHAT_WITH_CONDO_FLOW_TYPE,
591595
context: {
592596
userInput: 'test',
@@ -612,7 +616,7 @@ describe('ExecutionAIFlowTask', () => {
612616
const safeMimeType = CHAT_WITH_CONDO_ALLOWED_MIME_TYPES[0]
613617

614618
await expectToThrowGQLError(async () => {
615-
await createTestExecutionAIFlowTask(adminClient, userClient.user, {
619+
await createTestExecutionAIFlowTask(userClient, userClient.user, {
616620
flowType: CHAT_WITH_CONDO_FLOW_TYPE,
617621
context: {
618622
userInput: 'test',
@@ -646,7 +650,7 @@ describe('ExecutionAIFlowTask', () => {
646650
}))
647651

648652
await expectToThrowGQLError(async () => {
649-
await createTestExecutionAIFlowTask(adminClient, userClient.user, {
653+
await createTestExecutionAIFlowTask(userClient, userClient.user, {
650654
flowType: CHAT_WITH_CONDO_FLOW_TYPE,
651655
context: {
652656
userInput: 'test',

0 commit comments

Comments
 (0)