summaryrefslogtreecommitdiff
path: root/app_expo/services/api/api-problem.test.ts
diff options
context:
space:
mode:
authorKirill Rogovoy <[email protected]>2021-07-23 11:02:26 +0300
committerKirill Rogovoy <[email protected]>2021-07-23 11:02:26 +0300
commit73308af061af5e17ac7d4a73fa027a2f303c70dd (patch)
tree816fb8231e13f58f7afe822742513b3150cdc871 /app_expo/services/api/api-problem.test.ts
parentb8c58914cc1e251ce161905340647b6824d0a7c4 (diff)
Update graph data when Emacs node changes + minor improvements
Diffstat (limited to 'app_expo/services/api/api-problem.test.ts')
-rw-r--r--app_expo/services/api/api-problem.test.ts100
1 files changed, 0 insertions, 100 deletions
diff --git a/app_expo/services/api/api-problem.test.ts b/app_expo/services/api/api-problem.test.ts
deleted file mode 100644
index f8b4041..0000000
--- a/app_expo/services/api/api-problem.test.ts
+++ /dev/null
@@ -1,100 +0,0 @@
-import { getGeneralApiProblem } from './api-problem'
-import { ApiErrorResponse } from 'apisauce'
-
-test('handles connection errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'CONNECTION_ERROR',
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'cannot-connect',
- temporary: true,
- })
-})
-
-test('handles network errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'NETWORK_ERROR',
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'cannot-connect',
- temporary: true,
- })
-})
-
-test('handles timeouts', () => {
- expect(
- getGeneralApiProblem({
- problem: 'TIMEOUT_ERROR',
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'timeout',
- temporary: true,
- })
-})
-
-test('handles server errors', () => {
- expect(getGeneralApiProblem({ problem: 'SERVER_ERROR' } as ApiErrorResponse<null>)).toEqual({
- kind: 'server',
- })
-})
-
-test('handles unknown errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'UNKNOWN_ERROR',
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'unknown',
- temporary: true,
- })
-})
-
-test('handles unauthorized errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'CLIENT_ERROR',
- status: 401,
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'unauthorized',
- })
-})
-
-test('handles forbidden errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'CLIENT_ERROR',
- status: 403,
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'forbidden',
- })
-})
-
-test('handles not-found errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'CLIENT_ERROR',
- status: 404,
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'not-found',
- })
-})
-
-test('handles other client errors', () => {
- expect(
- getGeneralApiProblem({
- problem: 'CLIENT_ERROR',
- status: 418,
- } as ApiErrorResponse<null>),
- ).toEqual({
- kind: 'rejected',
- })
-})
-
-test('handles cancellation errors', () => {
- expect(getGeneralApiProblem({ problem: 'CANCEL_ERROR' } as ApiErrorResponse<null>)).toBeNull()
-})