-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 188589592-debug-output-2
- Loading branch information
Showing
29 changed files
with
657 additions
and
209 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
import { AppElements as ae } from "../support/elements/app-elements"; | ||
|
||
context("Test the overall app", () => { | ||
beforeEach(() => { | ||
cy.visit(""); | ||
it("renders without crashing", () => { | ||
cy.visit("/"); | ||
cy.get("body").should("contain", "Loading..."); | ||
}); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { createContext } from "react"; | ||
import { AppConfigModelType } from "./models/app-config-model"; | ||
|
||
export const AppConfigContext = createContext<AppConfigModelType | undefined>(undefined); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from "react"; | ||
import { AppConfig, isAppMode } from "./types"; | ||
import appConfigJson from "./app-config.json"; | ||
import { AppConfigModel, AppConfigModelSnapshot } from "./models/app-config-model"; | ||
import { getUrlParam } from "./utils/utils"; | ||
import { AppConfigContext } from "./app-config-context"; | ||
|
||
export const loadAppConfig = (): AppConfig => { | ||
const defaultConfig = appConfigJson as AppConfig; | ||
const urlParamMode = getUrlParam("mode"); | ||
const configOverrides: Partial<AppConfig> = { | ||
mode: isAppMode(urlParamMode) ? urlParamMode : defaultConfig.mode | ||
}; | ||
|
||
return { | ||
...defaultConfig, | ||
...configOverrides, | ||
}; | ||
}; | ||
|
||
export const AppConfigProvider = ({ children }: { children: React.ReactNode }) => { | ||
const appConfigSnapshot = loadAppConfig() as AppConfigModelSnapshot; | ||
const appConfig = AppConfigModel.create(appConfigSnapshot); | ||
return <AppConfigContext.Provider value={appConfig}>{children}</AppConfigContext.Provider>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
{ | ||
"config": { | ||
"accessibility": { | ||
"keyboard_shortcut": "ctrl+?" | ||
}, | ||
"assistant": { | ||
"existing_assistant_id": "asst_Af8jrKYOFP4MxA9nse61yFBq", | ||
"instructions": "You are DAVAI, an Data Analysis through Voice and Artificial Intelligence partner. You are an intermediary for a user who is blind who wants to interact with data tables in a data analysis app named CODAP.", | ||
"model": "gpt-4o-mini", | ||
"use_existing": true | ||
}, | ||
"dimensions": { | ||
"height": 680, | ||
"width": 380 | ||
} | ||
} | ||
"accessibility": { | ||
"keyboardShortcut": "ctrl+?" | ||
}, | ||
"assistant": { | ||
"assistantId": "asst_Af8jrKYOFP4MxA9nse61yFBq", | ||
"instructions": "You are DAVAI, a Data Analysis through Voice and Artificial Intelligence partner. You are an intermediary for a user who is blind who wants to interact with data tables in a data analysis app named CODAP.", | ||
"modelName": "gpt-4o-mini", | ||
"useExisting": true | ||
}, | ||
"dimensions": { | ||
"height": 680, | ||
"width": 380 | ||
}, | ||
"mockAssistant": false, | ||
"mode": "production" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,34 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { App } from "./App"; | ||
import { mockAppConfig } from "../test-utils/mock-app-config"; | ||
import { MockAppConfigProvider } from "../test-utils/app-config-provider"; | ||
|
||
jest.mock("../models/assistant-model", () => ({ | ||
assistantStore: { | ||
assistant: null, | ||
jest.mock("../hooks/use-assistant-store", () => ({ | ||
useAssistantStore: jest.fn(() => ({ | ||
initialize: jest.fn(), | ||
}, | ||
transcriptStore: { | ||
messages: [], | ||
addMessage: jest.fn(), | ||
}, | ||
})), | ||
})); | ||
|
||
jest.mock("../models/app-config-model", () => ({ | ||
AppConfigModel: { | ||
create: jest.fn(() => (mockAppConfig)), | ||
initialize: jest.fn(), | ||
} | ||
})); | ||
|
||
|
||
describe("test load app", () => { | ||
it("renders without crashing", () => { | ||
render(<App />); | ||
render( | ||
<MockAppConfigProvider> | ||
<App /> | ||
</MockAppConfigProvider> | ||
); | ||
expect(screen.getByText("Loading...")).toBeDefined(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.