Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Glowstudent777 committed Jan 1, 2025
1 parent e0fb48c commit 6bc2e5f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 52 deletions.
34 changes: 21 additions & 13 deletions .github/workflows/assignIssues.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
name: Assign Issues
name: Tests

on:
issues:
types: [opened]
push:
branches: [main]
pull_request:
branches: [main]

jobs:
auto-assign:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: 'Auto-assign issue'
uses: pozil/auto-assign-issue@v2
with:
assignees: Glowstudent777
allowSelfAssign: false
tests:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Node
uses: actions/setup-node@v3

- name: Install dependencies
run: npm install

- run: npm run test
66 changes: 36 additions & 30 deletions tests/verse.test.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,39 @@
import { getVerse } from "../src/api/v1/functions/verse";
import { expect, it, describe } from 'vitest';
import { getVerse } from "../src/api/v1/core/functions/verse";
import { expect, it, describe } from "vitest";

describe("getVerse", () => {
it("John 3:16", async () => {
const verse = await getVerse("John", "3", "16", "NIV");

expect(verse?.citation).toBe("John 3:16");
expect(verse?.passage).toBe("For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life.");
});

it("Genesis 1:1", async () => {
const verse = await getVerse("GEN", "1", "1", "KJV");

expect(verse?.citation).toBe("Genesis 1:1");
expect(verse?.passage).toBe("In the beginning God created the heaven and the earth.");
});

it("Invalid verse", async () => {
const verse = await getVerse("JHN", "3", "54", "NIV");

expect(verse?.code).toBe(400);
expect(verse?.message).toBe("Verse not found");
});

it("Invalid book", async () => {
const book = "Coffee";
const verse = await getVerse(book, "5", "11", "NIV");

expect(verse?.code).toBe(400);
expect(verse?.message).toBe(`Could not find book '${book}' by name or alias.`);
});
it("John 3:16", async () => {
const verse = await getVerse("John", "3", "16", "NIV");

expect(verse?.citation).toBe("John 3:16");
expect(verse?.passage).toBe(
"For God so loved the world that he gave his one and only Son, that whoever believes in him shall not perish but have eternal life."
);
});

it("Genesis 1:1", async () => {
const verse = await getVerse("GEN", "1", "1", "KJV");

expect(verse?.citation).toBe("Genesis 1:1");
expect(verse?.passage).toBe(
"In the beginning God created the heaven and the earth."
);
});

it("Invalid verse", async () => {
const verse = await getVerse("JHN", "3", "54", "NIV");

expect(verse?.code).toBe(400);
expect(verse?.message).toBe("Verse not found");
});

it("Invalid book", async () => {
const book = "Coffee";
const verse = await getVerse(book, "5", "11", "NIV");

expect(verse?.code).toBe(400);
expect(verse?.message).toBe(
`Could not find book '${book}' by name or alias.`
);
});
});
18 changes: 9 additions & 9 deletions tests/votd.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { getVotd } from "../src/api/v1/functions/votd";
import { expect, it, describe } from 'vitest';
import { getVotd } from "../src/api/v1/core/functions/votd";
import { expect, it, describe } from "vitest";

describe("getVotd", () => {
it("VOTD", async () => {
const verse = await getVotd("en");
const verse2 = await getVotd("coffee");
it("VOTD", async () => {
const verse = await getVotd("en");
const verse2 = await getVotd("coffee");

expect(verse?.citation).toBeDefined();
expect(verse?.passage).toBeDefined();
expect(verse?.citation).toBeDefined();
expect(verse?.passage).toBeDefined();

expect(verse2).toBeUndefined();
});
expect(verse2).toBeUndefined();
});
});

0 comments on commit 6bc2e5f

Please sign in to comment.