Skip to content

Commit

Permalink
[intepreter][Canvas] Dedupe server functions in batched requests (ela…
Browse files Browse the repository at this point in the history
…stic#32712)

* [intepreter][Canvas] Dedupe server functions in batched requests

* Add and correct tests
  • Loading branch information
clintandrewhall committed Mar 10, 2019
1 parent 2c2637d commit 600cbcd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/kbn-interpreter/src/public/interpreter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ describe('kbn-interpreter/interpreter', () => {
it('loads server-side functions', async () => {
const kfetch = jest.fn(async () => ({}));

await initializeInterpreter(kfetch, { toJS: () => ({}) }, ({ register: () => {} }));
await initializeInterpreter({
kfetch,
ajaxStream,
typesRegistry: { toJS: () => ({}) },
functionsRegistry: { register: () => {} },
});

expect(kfetch).toHaveBeenCalledTimes(1);
expect(kfetch).toHaveBeenCalledWith({ pathname: FUNCTIONS_URL });
Expand All @@ -63,7 +68,12 @@ describe('kbn-interpreter/interpreter', () => {

const register = jest.fn();

await initializeInterpreter(kfetch, { toJS: () => ({}) }, ({ register }));
await initializeInterpreter({
kfetch,
ajaxStream,
typesRegistry: { toJS: () => ({}) },
functionsRegistry: { register },
});

expect(register).toHaveBeenCalledTimes(2);

Expand Down

0 comments on commit 600cbcd

Please sign in to comment.