Skip to content

Commit 6ee852a

Browse files
committed
feat: 🎸 update code to pass tests with rpc-error usage
1 parent 4749546 commit 6ee852a

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/__tests__/json-crdt-server/block.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ export const runBlockTests = (_setup: ApiTestSetup, params: {staticOnly?: true}
690690
const {call, stop} = await setup();
691691
const id = getId();
692692
const get1 = await of(call('block.get', {id}));
693-
expect(get1[1]).toMatchObject({message: 'NOT_FOUND'});
693+
expect(get1[1]).toMatchObject({code: 'NOT_FOUND'});
694694
const result = await call('block.pull', {
695695
id,
696696
seq: -1,

src/common/rpc/__tests__/RpcMessageStreamProcessor.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ describe('pre-call checks', () => {
730730
expect(send).toHaveBeenCalledTimes(1);
731731
const errorValue = send.mock.calls[0][0][0];
732732
expect(errorValue).toBeInstanceOf(ResponseErrorMessage);
733-
expect(errorValue.value.data.message).toBe('BUFFER_OVERFLOW');
733+
expect(errorValue.value.data.message).toBe('OVERFLOW');
734734
});
735735

736736
test('buffer size can be set to 5 for the whole server', async () => {
@@ -766,7 +766,7 @@ describe('pre-call checks', () => {
766766
await new Promise((r) => setTimeout(r, 1));
767767
expect(send).toHaveBeenCalledTimes(1);
768768
expect(send.mock.calls[0][0][0]).toBeInstanceOf(ResponseErrorMessage);
769-
expect(send.mock.calls[0][0][0].value.data.message).toBe('BUFFER_OVERFLOW');
769+
expect(send.mock.calls[0][0][0].value.data.message).toBe('OVERFLOW');
770770
});
771771

772772
test('buffer size can be set to 5 per method', async () => {
@@ -802,7 +802,7 @@ describe('pre-call checks', () => {
802802
await new Promise((r) => setTimeout(r, 1));
803803
expect(send).toHaveBeenCalledTimes(1);
804804
expect(send.mock.calls[0][0][0]).toBeInstanceOf(ResponseErrorMessage);
805-
expect(send.mock.calls[0][0][0].value.data.message).toBe('BUFFER_OVERFLOW');
805+
expect(send.mock.calls[0][0][0].value.data.message).toBe('OVERFLOW');
806806
});
807807

808808
test('when pre-call checks finish just before buffer is full, can receive more request data', async () => {
@@ -929,9 +929,9 @@ describe('buffering', () => {
929929
await new Promise((r) => setTimeout(r, 10));
930930
expect(send).toHaveBeenCalledTimes(1);
931931
expect(send.mock.calls[0][0][0]).toBeInstanceOf(ResponseErrorMessage);
932-
expect(send.mock.calls[0][0][0].value.data.message).toBe('METHOD_NOT_FOUND');
932+
expect(send.mock.calls[0][0][0].value.data.message).toBe('METHOD_UNK');
933933
expect(send.mock.calls[0][0][1]).toBeInstanceOf(ResponseErrorMessage);
934-
expect(send.mock.calls[0][0][1].value.data.message).toBe('METHOD_NOT_FOUND');
934+
expect(send.mock.calls[0][0][1].value.data.message).toBe('METHOD_UNK');
935935
expect(send.mock.calls[0][0][0]).toBeInstanceOf(ResponseErrorMessage);
936936
expect(send.mock.calls[0][0][1]).toBeInstanceOf(ResponseErrorMessage);
937937
});

src/util/rx/__tests__/BufferSubject.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ test('error when buffer overflows', () => {
3333
expect(complete).toHaveBeenCalledTimes(0);
3434

3535
expect(error.mock.calls[0][0]).toBeInstanceOf(Error);
36-
expect(error.mock.calls[0][0].message).toMatchInlineSnapshot(`"BUFFER_OVERFLOW"`);
36+
expect(error.mock.calls[0][0].message).toMatchInlineSnapshot(`"OVERFLOW"`);
3737
});
3838

3939
test('does not error when buffer was flushed just before overflow', () => {

0 commit comments

Comments
 (0)