Skip to content

Commit

Permalink
fix: add _language prop to Answers type
Browse files Browse the repository at this point in the history
  • Loading branch information
KuznetsovRoman committed Feb 8, 2024
1 parent b405e42 commit 48d75bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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

0 comments on commit 48d75bd

Please sign in to comment.