|
1 | | -import { fallbackORPCErrorMessage, fallbackORPCErrorStatus, isDefinedError, ORPCError, toORPCError } from './error' |
| 1 | +import { fallbackORPCErrorMessage, fallbackORPCErrorStatus, isDefinedError, isORPCErrorStatus, ORPCError, toORPCError } from './error' |
2 | 2 |
|
3 | 3 | it('fallbackORPCErrorStatus', () => { |
4 | 4 | expect(fallbackORPCErrorStatus('BAD_GATEWAY', 500)).toBe(500) |
@@ -42,9 +42,9 @@ describe('oRPCError', () => { |
42 | 42 |
|
43 | 43 | it('oRPCError throw when invalid status', () => { |
44 | 44 | expect(() => new ORPCError('BAD_GATEWAY', { status: 200 })).toThrowError() |
45 | | - expect(() => new ORPCError('BAD_GATEWAY', { status: 299 })).toThrowError() |
| 45 | + expect(() => new ORPCError('BAD_GATEWAY', { status: 399 })).toThrowError() |
46 | 46 |
|
47 | | - expect(() => new ORPCError('BAD_GATEWAY', { status: 300 })).not.toThrowError() |
| 47 | + expect(() => new ORPCError('BAD_GATEWAY', { status: 400 })).not.toThrowError() |
48 | 48 | expect(() => new ORPCError('BAD_GATEWAY', { status: 199 })).not.toThrowError() |
49 | 49 | }) |
50 | 50 |
|
@@ -107,3 +107,12 @@ it('toORPCError', () => { |
107 | 107 | return true |
108 | 108 | }) |
109 | 109 | }) |
| 110 | + |
| 111 | +it('isORPCErrorStatus', () => { |
| 112 | + expect(isORPCErrorStatus(200)).toBe(false) |
| 113 | + expect(isORPCErrorStatus(399)).toBe(false) |
| 114 | + |
| 115 | + expect(isORPCErrorStatus(400)).toBe(true) |
| 116 | + expect(isORPCErrorStatus(499)).toBe(true) |
| 117 | + expect(isORPCErrorStatus(199)).toBe(true) |
| 118 | +}) |
0 commit comments