Skip to content

Commit

Permalink
Refactor code to use new naming conventions and update tests
Browse files Browse the repository at this point in the history
The commit message suggests that the code has been refactored to use new naming conventions and the tests have been updated accordingly.

Generated by gpt-3.5-turbo
  • Loading branch information
joone committed Feb 1, 2024
1 parent 8092918 commit 79a837a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} npm test -- --grep=Loz.init
- run: OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} npm test
31 changes: 12 additions & 19 deletions tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from "chai";
import "mocha";
import * as mockStdin from "mock-stdin";

describe("Loz.init", () => {
describe("openai", () => {
let stdin: mockStdin.MockSTDIN;

before(() => {
Expand Down Expand Up @@ -34,7 +34,8 @@ describe("Loz.init", () => {
});
});

describe("Loz.chekcEnv()", () => {
// npm test -- --grep=Loz.checkEnv
describe("loz.checkEnv", () => {
it("should return true", () => {
let loz = new Loz();

Expand All @@ -43,22 +44,14 @@ describe("Loz.chekcEnv()", () => {
});
});

describe("Loz.ollama", () => {
it("should return true", async () => {
let loz = new Loz("ollama");
await loz.init();

const completion = await loz.completeUserPrompt("1+1");
expect(completion.content).to.equal("2");
});
});
if (process.env.LOZ_LOCAL_TEST === "true") {
describe("Loz.ollama", () => {
it("should return true", async () => {
let loz = new Loz("ollama");
await loz.init();

describe("Loz.openai", () => {
it("should return true", async () => {
let loz = new Loz("openai");
await loz.init();

const completion = await loz.completeUserPrompt("1+1");
expect(completion.content).to.equal("2");
const completion = await loz.completeUserPrompt("1+1=");
expect(completion.content).to.equal("2");
});
});
});
}

0 comments on commit 79a837a

Please sign in to comment.