Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chaspy committed Dec 7, 2022
1 parent ad93a8a commit 03f49ca
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions functions/response_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,24 @@ Deno.test("Response function test -- keyword with place", async () => {
assertEquals(answerArray.includes(`${outputs?.response}`), true);
});

// when: @hanakin 今日目黒でノンアル花金?
// expect: return recomended-food at 目黒
Deno.test("Response function test -- keyword with place", async () => {
// generate test data
const answerArray: string[] = [];
const array = conf.recommended_bar["目黒"];
array.forEach((e) => {
answerArray.push(
`今日は花金!${e.name}${e.main}を食べよう!${e.url}`,
);
});

// test
const inputs = { message: `<@ABCDEFGHIJK> 今日目黒でノンアル花金?` };
const { outputs } = await ResponseFunction(createContext({ inputs }));
assertEquals(answerArray.includes(`${outputs?.response}`), true);
});

// when: @hanakin 今日福岡で花金?
// expect: return usage
Deno.test("Response function test -- keyword with wrong place", async () => {
Expand Down

0 comments on commit 03f49ca

Please sign in to comment.