Skip to content

Instantly share code, notes, and snippets.

@jaredlockhart
Created September 27, 2017 20:00
Show Gist options
  • Save jaredlockhart/e8fc88a127868afbfde3cb5aa6e9d458 to your computer and use it in GitHub Desktop.
Save jaredlockhart/e8fc88a127868afbfde3cb5aa6e9d458 to your computer and use it in GitHub Desktop.
38 it('should send experiment to normandy and send accept to experimenter', async () => {
39 const experiment = ExperimentFactory.build();
40 const createRecipeResponse = {};
41 fetchMock.mock('/api/v2/recipe/', createRecipeResponse, {method: 'POST'});
42 fetchMock.mock(experiment.accept_url, 'accepted', {method: 'PATCH'});
43
44 const dispatch = action => {
45 console.log('dispatch called');
46 switch (typeof action) {
47 case "function":
48 console.log('function received, invoking with this');
49 return action(this);
50 case "object":
51 console.log('object received, its an action!', action);
52 }
53 };
54
55 await importExperiment(experiment)(dispatch);
56 });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment