fix(frontend-plugin-api): default api config error
Signed-off-by: Camila Belo <camilaibs@gmail.com>
This commit is contained in:
@@ -35,8 +35,8 @@ describe('AnalyticsContext', () => {
|
||||
it('returns default values', () => {
|
||||
const { result } = renderHook(() => useAnalyticsContext());
|
||||
expect(result.current).toEqual({
|
||||
extensionId: 'App',
|
||||
pluginId: 'root',
|
||||
extensionId: 'app',
|
||||
pluginId: 'app',
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -49,8 +49,8 @@ describe('AnalyticsContext', () => {
|
||||
</AnalyticsContext>,
|
||||
);
|
||||
|
||||
expect(result.getByTestId('extension-id')).toHaveTextContent('App');
|
||||
expect(result.getByTestId('plugin-id')).toHaveTextContent('root');
|
||||
expect(result.getByTestId('extension-id')).toHaveTextContent('app');
|
||||
expect(result.getByTestId('plugin-id')).toHaveTextContent('app');
|
||||
});
|
||||
|
||||
it('uses provided analytics context', () => {
|
||||
@@ -60,7 +60,7 @@ describe('AnalyticsContext', () => {
|
||||
</AnalyticsContext>,
|
||||
);
|
||||
|
||||
expect(result.getByTestId('extension-id')).toHaveTextContent('App');
|
||||
expect(result.getByTestId('extension-id')).toHaveTextContent('app');
|
||||
expect(result.getByTestId('plugin-id')).toHaveTextContent('custom');
|
||||
});
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export const useAnalyticsContext = (): AnalyticsContextValue => {
|
||||
if (theContext === undefined) {
|
||||
return {
|
||||
pluginId: 'app',
|
||||
extensionId: 'App',
|
||||
extensionId: 'app',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ describe('useAnalytics', () => {
|
||||
some: 'value',
|
||||
},
|
||||
context: {
|
||||
extensionId: 'App',
|
||||
pluginId: 'root',
|
||||
extensionId: 'app',
|
||||
pluginId: 'app',
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -23,8 +23,11 @@ import { Tracker } from './Tracker';
|
||||
function useAnalyticsApi(): AnalyticsApi {
|
||||
try {
|
||||
return useApi(analyticsApiRef);
|
||||
} catch {
|
||||
return { captureEvent: () => {} };
|
||||
} catch (error) {
|
||||
if (error.name === 'NotImplementedError') {
|
||||
return { captureEvent: () => {} };
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user