Skip to content

Commit

Permalink
chore: gh workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Emmanuel-Develops committed Jul 25, 2024
1 parent dfa80f1 commit a0d9ddf
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 4 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/external-dependencies-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: External Dependencies Tests

on:
pull_request:
branches: [main]

jobs:
ext-deps-tests:
name: Test external dependencies
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"
- run: yarn install --frozen-lockfile
- name: Run external dependencies tests
run: yarn test-ext-deps
21 changes: 21 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Unit Test

on:
pull_request:
branches: []

jobs:
ext-deps-tests:
name: Unit Test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
cache: "yarn"
- run: yarn install --frozen-lockfile
- name: Run Unit tests
run: yarn test-unit
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest"
"test-ext-deps": "jest externalDependency",
"test-unit": "jest unit"
},
"dependencies": {
"@chakra-ui/react": "^2.4.9",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GPTKeywordExtractor } from "@/service/chat/extractor";
import { chatHistory, chatHistoryContextAware, chatHistorySwitchContext } from "./__mocks__/mockChatHistory";
import { chatHistory, chatHistoryContextAware, chatHistorySwitchContext } from "@/__tests__/__mocks__/mockChatHistory";

describe("GPTKeywordExtractor", () => {
it("should extract keywords from a given history", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { responseData, responseDataBody, responseDataFUQ, responseDataLinks } from "./__mocks__/apiResponse";
import { separateLinksFromApiMessage } from "../utils/links";
import { responseData, responseDataBody, responseDataFUQ, responseDataLinks } from "@/__tests__/__mocks__/apiResponse";
import { separateLinksFromApiMessage } from "@/utils/links";

describe("apiMessageSeparator", () => {
const {messageBody, messageLinks, messageQuestions} = separateLinksFromApiMessage(responseData);
Expand Down

0 comments on commit a0d9ddf

Please sign in to comment.