MCPcopy
hub / github.com/nytimes/react-tracking / TestOptions

Function TestOptions

src/__tests__/hooks.test.js:68–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66
67 it('accepts a dispatch function in options', () => {
68 function TestOptions() {
69 const { trackEvent } = useTracking(testDataContext, { dispatch });
70
71 const blah = () => {
72 trackEvent(testData);
73 };
74
75 blah();
76 return <div />;
77 }
78
79 mount(<TestOptions />);
80
81 expect(dispatchTrackingEvent).not.toHaveBeenCalled();
82 expect(dispatch).toHaveBeenCalledWith({
83 ...testDataContext,
84 ...testData,
85 });
86 });
87
88 it('will use dispatch fn passed in from further up in context', () => {
89 const testChildData = { page: 'TestChild' };

Callers

nothing calls this directly

Calls 3

useTrackingFunction · 0.85
blahFunction · 0.85
exampleMethodFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…