Skip to content

Commit

Permalink
add tests and add scheduled session cleanup workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hillalex committed Dec 11, 2024
1 parent ec6391c commit 7dab5a7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 🗑 Cleanup session files

on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 * * * *'

jobs:
cleanup:
name: 🗑 Cleanup
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: curl https://seroviz.seroanalytics.org/api/
12 changes: 12 additions & 0 deletions test/components/FAQ.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";
import {render, screen} from "@testing-library/react";
import FAQ from "../../src/components/FAQ";

describe("<FAQ />", () => {
test("renders FAQ", async () => {

render(<FAQ/>);
const list = await screen.findAllByRole("listitem");
expect(list.length).toBe(5);
});
});
6 changes: 6 additions & 0 deletions test/components/TopNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import {
} from "../../src/RootContext";
import TopNav from "../../src/components/TopNav";

test("Displays FAQ link", async () => {
render(<TopNav theme={"light"} setTheme={jest.fn()}/>);
const faq = screen.getByText("FAQ") as HTMLAnchorElement;
expect(faq.href).toBe("http://localhost/faq");
});

test("user can end session", async () => {
mockAxios.onDelete(`/session/`)
.reply(200, mockSuccess("OK"));
Expand Down

0 comments on commit 7dab5a7

Please sign in to comment.