Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add _language prop to Answers type #22

Merged
merged 1 commit into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/types/toolOpts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface GeneralPrompt {

export interface Answers extends Record<string, unknown> {
_path: string;
_language: Language;
}

export type HandleGeneralPromptsCallback = (
Expand Down
18 changes: 15 additions & 3 deletions src/utils/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,21 @@ describe("utils", () => {

describe("baseGeneralPromptsHandler", () => {
it("should set baseUrl", async () => {
const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, { _path: "/", baseUrl: "foo" });
const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, {
_path: "/",
_language: "ts",
baseUrl: "foo",
});

expect(result).toStrictEqual({ baseUrl: "foo" });
});

it("should set gridUrl", async () => {
const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, { _path: "/", gridUrl: "foo" });
const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, {
_path: "/",
_language: "ts",
gridUrl: "foo",
});

expect(result).toStrictEqual({ gridUrl: "foo" });
});
Expand All @@ -128,6 +136,7 @@ describe("utils", () => {

const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, {
_path: "/",
_language: "ts",
addChromePhone: true,
});

Expand All @@ -152,7 +161,10 @@ describe("utils", () => {
});

it("should do nothing if no answers given", async () => {
const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, { _path: "/" });
const result = await utils.baseGeneralPromptsHandler({} as HermioneConfig, {
_path: "/",
_language: "ts",
});

expect(result).toStrictEqual({});
});
Expand Down
Loading