File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import { useStore } from "@nanostores/react";
1919import { type PolicyProps , PolicyProvider } from "~/components/policies" ;
2020import { createContext } from "react" ;
2121
22- export const FirebaseUIContext = createContext < FirebaseUI > ( { } as FirebaseUI ) ;
22+ export const FirebaseUIContext = createContext < FirebaseUI > ( null as unknown as FirebaseUI ) ;
2323
2424export type FirebaseUIProviderProps = {
2525 children : React . ReactNode ;
Original file line number Diff line number Diff line change @@ -63,11 +63,10 @@ describe("useUI", () => {
6363 expect ( result . current ) . toEqual ( mockUI . get ( ) ) ;
6464 } ) ;
6565
66- // TODO(ehesp): This test is not working as expected.
67- it . skip ( "throws an error if no context is found" , ( ) => {
66+ it ( "throws an error if no context is found" , ( ) => {
6867 expect ( ( ) => {
6968 renderHook ( ( ) => useUI ( ) ) ;
70- } ) . toThrow ( "No FirebaseUI context found. Your application must be wrapped in a <FirebaseUIProvider> component." ) ;
69+ } ) . toThrow ( ) ;
7170 } ) ;
7271
7372 it ( "returns updated values when nanostore state changes via setState" , ( ) => {
Original file line number Diff line number Diff line change @@ -40,7 +40,14 @@ export function useUI() {
4040
4141 if ( ! ui ) {
4242 throw new Error (
43- "No FirebaseUI context found. Your application must be wrapped in a <FirebaseUIProvider> component."
43+ `No FirebaseUI context found. Your application must be wrapped in a FirebaseUIProvider:
44+
45+ const ui = initializeUI(...);
46+
47+ <FirebaseUIProvider ui={ui}>
48+ <App />
49+ </FirebaseUIProvider>
50+ `
4451 ) ;
4552 }
4653
You can’t perform that action at this time.
0 commit comments