Skip to content

Commit a2e82c0

Browse files
committed
fix: tests
1 parent 4dcaf8a commit a2e82c0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

packages/core/src/services/evaluationsV2/outputs/extract.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ describe('extractActualOutput', () => {
8080
]
8181
})
8282

83-
it('fails when conversation does not contain any assistant messages', async () => {
84-
await expect(
83+
it('fails when conversation does not contain any assistant messages', () => {
84+
expect(() =>
8585
extractActualOutput({
8686
conversation: conversation,
8787
configuration: {
@@ -90,37 +90,37 @@ describe('extractActualOutput', () => {
9090
parsingFormat: 'string',
9191
},
9292
}).unwrap(),
93-
).rejects.toThrowError(
93+
).toThrowError(
9494
new UnprocessableEntityError(
9595
'Conversation does not contain any assistant messages with file content',
9696
),
9797
)
9898
})
9999

100-
it('fails when output cannot be parsed with the format', async () => {
100+
it('fails when output cannot be parsed with the format', () => {
101101
;(conversation[2].content[3] as unknown as TextContent).text =
102102
'not a valid json'
103103

104-
await expect(
104+
expect(() =>
105105
extractActualOutput({
106106
conversation,
107107
configuration: {
108108
messageSelection: 'last',
109109
parsingFormat: 'json',
110110
},
111111
}).unwrap(),
112-
).rejects.toThrowError(
112+
).toThrowError(
113113
new UnprocessableEntityError(
114114
`Unexpected token 'o', "not a valid json" is not valid JSON`,
115115
),
116116
)
117117
})
118118

119-
it('fails when field is not present in the output', async () => {
119+
it('fails when field is not present in the output', () => {
120120
;(conversation[2].content[3] as unknown as TextContent).text =
121121
'{"answer": 42}'
122122

123-
await expect(
123+
expect(() =>
124124
extractActualOutput({
125125
conversation,
126126
configuration: {
@@ -129,20 +129,20 @@ describe('extractActualOutput', () => {
129129
fieldAccessor: 'response',
130130
},
131131
}).unwrap(),
132-
).rejects.toThrowError(
132+
).toThrowError(
133133
new UnprocessableEntityError(
134134
`Field 'response' is not present in the actual output`,
135135
),
136136
)
137137
})
138138

139-
it('fails when configuration is not set', async () => {
140-
await expect(
139+
it('fails when configuration is not set', () => {
140+
expect(() =>
141141
extractActualOutput({
142142
conversation,
143143
configuration: undefined as any,
144144
}).unwrap(),
145-
).rejects.toThrowError(
145+
).toThrowError(
146146
new TypeError(
147147
"Cannot read properties of undefined (reading 'contentFilter')",
148148
),

0 commit comments

Comments
 (0)