Skip to content

Commit

Permalink
fix(test): ai response partially match
Browse files Browse the repository at this point in the history
  • Loading branch information
nonumpa committed Apr 22, 2024
1 parent 53dda12 commit 625fbb1
Showing 1 changed file with 15 additions and 43 deletions.
58 changes: 15 additions & 43 deletions src/graphql/__tests__/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ if (process.env.GCS_BUCKET_NAME) {
createdAt,
// eslint-disable-next-line no-unused-vars
updatedAt,
text,
...aiResponse
} = await createTranscript(
{
Expand All @@ -130,50 +131,21 @@ if (process.env.GCS_BUCKET_NAME) {
{ id: 'user-id', appId: 'app-id' }
);

// Expect some keywords are identified.
// The whole text are not always 100% identical, but these keywords should be always included.
expect(text).toMatch(/^排/);
expect(text).toMatch(/德國醫學博士艾倫斯特發現/);
expect(text).toMatch(/汗也具有調節體溫的重要作用/);
expect(aiResponse).toMatchInlineSnapshot(`
Object {
"appId": "app-id",
"docId": "foo",
"status": "SUCCESS",
"text": "排
汗和排尿的差別
想要健康長壽就要想辦法一天一次大量排汗
德國醫學博士艾倫斯特發現:所有運動選手中
唯獨馬拉松選手沒有罹患癌症病例。
艾倫斯特博士採集了每天跑步 30 公里以上的
馬拉松選手的汗水,分析其汗水的成份結果
發現汗水中含有 鎘 鉛銅鎳等之重金屬物質。
證明出汗是排泄體內疲勞物質及對人體有害的
重金屬毒素的重要途徑
雖然排泄體內不需要物質的基本功能,有排便
排尿與出汗。而尿也會排出重金屬,但是排出
功能卻遠不及汗。
汗與尿中的重金屬元素量
鉛(微克)鎘(微克)鈷(微克)
6.5
1.2
0.65
0.6
汗 84
尿 4.9
100 克 中〉
鎳(微克)銅(毫克)
32
0.11
3.1
0.01
汗也具有調節體溫的重要作用。 全身健康的
出汗,就能夠強化現代最欠缺的體溫調節功能
與自律神經。
藉著汗,氣化熱消耗熱量,能夠提升代謝力,
不但減少體脂肪,還有助於消除肥胖。
可以先從關掉冷氣做起
",
"type": "TRANSCRIPT",
"userId": "user-id",
}
`);
Object {
"appId": "app-id",
"docId": "foo",
"status": "SUCCESS",
"type": "TRANSCRIPT",
"userId": "user-id",
}
`);

// Cleanup
await client.delete({
index: 'airesponses',
Expand Down

0 comments on commit 625fbb1

Please sign in to comment.