Skip to content

Commit e2a0bf0

Browse files
committed
test: Fix test failures
1 parent 790b55f commit e2a0bf0

File tree

1 file changed

+6
-46
lines changed

1 file changed

+6
-46
lines changed

packages/kernel-browser-runtime/src/kernel-worker/captp/kernel-facade.test.ts

Lines changed: 6 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ describe('makeKernelFacade', () => {
2424
beforeEach(() => {
2525
mockKernel = {
2626
launchSubcluster: vi.fn().mockResolvedValue({
27-
body: '#{"status":"ok"}',
28-
slots: [],
27+
subclusterId: 'sc1',
28+
bootstrapRootKref: 'ko1',
2929
}),
3030
terminateSubcluster: vi.fn().mockResolvedValue(undefined),
3131
queueMessage: vi.fn().mockResolvedValue({
@@ -60,10 +60,10 @@ describe('makeKernelFacade', () => {
6060
expect(mockKernel.launchSubcluster).toHaveBeenCalledTimes(1);
6161
});
6262

63-
it('returns result from kernel with parsed subclusterId and wrapped kref', async () => {
63+
it('returns result with subclusterId and rootKref from kernel', async () => {
6464
const kernelResult = {
65-
body: '#{"subclusterId":"s1"}',
66-
slots: ['ko1'],
65+
subclusterId: 's1',
66+
bootstrapRootKref: 'ko1',
6767
};
6868
vi.mocked(mockKernel.launchSubcluster).mockResolvedValueOnce(
6969
kernelResult,
@@ -73,11 +73,9 @@ describe('makeKernelFacade', () => {
7373

7474
const result = await facade.launchSubcluster(config);
7575

76-
// The facade should parse the CapData and return a LaunchResult
7776
expect(result).toStrictEqual({
7877
subclusterId: 's1',
79-
rootKref: { kref: 'ko1' },
80-
rootKrefString: 'ko1',
78+
rootKref: 'ko1',
8179
});
8280
});
8381

@@ -88,44 +86,6 @@ describe('makeKernelFacade', () => {
8886

8987
await expect(facade.launchSubcluster(config)).rejects.toThrow(error);
9088
});
91-
92-
it('throws when kernel returns no capData', async () => {
93-
vi.mocked(mockKernel.launchSubcluster).mockResolvedValueOnce(
94-
undefined as unknown as ReturnType<Kernel['launchSubcluster']>,
95-
);
96-
97-
const config = makeClusterConfig();
98-
99-
await expect(facade.launchSubcluster(config)).rejects.toThrow(
100-
'launchSubcluster: expected capData with root kref',
101-
);
102-
});
103-
104-
it('throws when capData body has no subclusterId', async () => {
105-
vi.mocked(mockKernel.launchSubcluster).mockResolvedValueOnce({
106-
body: '#{}',
107-
slots: ['ko1'],
108-
});
109-
110-
const config = makeClusterConfig();
111-
112-
await expect(facade.launchSubcluster(config)).rejects.toThrow(
113-
'launchSubcluster: expected subclusterId in body',
114-
);
115-
});
116-
117-
it('throws when capData slots is empty', async () => {
118-
vi.mocked(mockKernel.launchSubcluster).mockResolvedValueOnce({
119-
body: '#{"subclusterId":"sc1"}',
120-
slots: [],
121-
});
122-
123-
const config = makeClusterConfig();
124-
125-
await expect(facade.launchSubcluster(config)).rejects.toThrow(
126-
'launchSubcluster: expected root kref in slots',
127-
);
128-
});
12989
});
13090

13191
describe('terminateSubcluster', () => {

0 commit comments

Comments
 (0)