forked from Schotsl/Plausible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.ts
33 lines (25 loc) · 819 Bytes
/
test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import PlausibleAPI from "./index.ts";
import { initializeEnv } from "./helper.ts";
initializeEnv([
"PLAUSIBLE_TOKEN",
"PLAUSIBLE_SITE",
"PLAUSIBLE_URL",
]);
const plausibleAPI = new PlausibleAPI(
Deno.env.get("PLAUSIBLE_TOKEN")!,
Deno.env.get("PLAUSIBLE_SITE")!,
Deno.env.get("PLAUSIBLE_URL")!,
);
// Do the bare minimum and check if every function runs without crashing
Deno.test("get realtime pageviews", async () => {
await plausibleAPI.getRealtime();
});
Deno.test("get aggregated pageviews", async () => {
await plausibleAPI.getAggregate("6mo", "pageviews");
});
Deno.test("get pageviews timeseries", async () => {
await plausibleAPI.getTimeseries("6mo", "pageviews");
});
Deno.test("get pageviews breakdown", async () => {
await plausibleAPI.getBreakdown("6mo", "visit:country");
});