Navigation Menu

Skip to content

Commit

Permalink
fix handling of kernel info
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Silvester committed May 5, 2020
1 parent 8fb2f4a commit 0a780fe
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
20 changes: 19 additions & 1 deletion testutils/src/mock.ts
Expand Up @@ -187,7 +187,7 @@ export const KernelMock = jest.fn<
});
return newKernel;
}),
info: Promise.resolve(void 0),
info: Promise.resolve(Private.getInfo(model!.name!)),
shutdown: jest.fn(() => Promise.resolve(void 0)),
requestHistory: jest.fn(() => {
const historyReply = KernelMessage.createMessage({
Expand Down Expand Up @@ -778,6 +778,24 @@ namespace Private {
});
}

// Get the kernel info for kernel name
export function getInfo(
name: string
): KernelMessage.IInfoReplyMsg['content'] {
return {
protocol_version: '1',
implementation: 'foo',
implementation_version: '1',
language_info: {
version: '1',
name
},
banner: 'hello, world!',
help_links: [],
status: 'ok'
};
}

export function changeKernel(
kernel: Kernel.IKernelConnection,
partialModel: Partial<Kernel.IModel>
Expand Down
4 changes: 2 additions & 2 deletions testutils/test/mock.spec.ts
Expand Up @@ -114,10 +114,10 @@ describe('mock', () => {
});

describe('.info', () => {
it('should resolve with undefined', async () => {
it('should resolve with info', async () => {
const kernel = new Mock.KernelMock({});
const info = await kernel.info;
expect(info).toBeUndefined();
expect(info.language_info.name).toBe(Mock.DEFAULT_NAME);
});
});

Expand Down

0 comments on commit 0a780fe

Please sign in to comment.