-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { distilledUserWithin24Hours } from "../library/distilled_user_within_24hour.js"; | ||
import { getNowTime } from "../library/get_time.js"; | ||
|
||
Deno.test("デモテスト", () => { | ||
assertEquals(1 + 1, 2); | ||
Deno.test("24時間以内に交流したユーザだけ取得できる", async () => { | ||
const request = new Request("https://example.com/?id=1"); | ||
const user1 = { | ||
key: ["SP", 1, 2], | ||
value: { | ||
User: 2, | ||
time: getNowTime(), | ||
}, | ||
}; | ||
const user2 = { | ||
key: ["SP", 2, 3], | ||
value: { | ||
User: 3, | ||
time: getNowTime(), | ||
}, | ||
}; | ||
const kv = { | ||
list: async function* () { | ||
yield user1; | ||
yield user2; | ||
}, | ||
}; | ||
|
||
const response = await distilledUserWithin24Hours(request, kv); | ||
|
||
const data = await response.json(); | ||
assertEquals(data, [user1]); | ||
}); |