summaryrefslogtreecommitdiff
path: root/app/services/api/api-problem.test.ts
diff options
context:
space:
mode:
authorKirill Rogovoy <[email protected]>2021-07-19 20:06:08 +0300
committerKirill Rogovoy <[email protected]>2021-07-19 20:06:08 +0300
commitf0bf4e7afdcd8b02a62be45ab3e7d047ed865a79 (patch)
tree575c0ff2cbb846252bd2e494c81c396846aab2f6 /app/services/api/api-problem.test.ts
parent67ad38d0a7cd319623e9f41c0c381ed5c5f6f973 (diff)
Apply Prettier
Diffstat (limited to 'app/services/api/api-problem.test.ts')
-rw-r--r--app/services/api/api-problem.test.ts94
1 files changed, 63 insertions, 31 deletions
diff --git a/app/services/api/api-problem.test.ts b/app/services/api/api-problem.test.ts
index ccd35c9..2b37aa9 100644
--- a/app/services/api/api-problem.test.ts
+++ b/app/services/api/api-problem.test.ts
@@ -1,72 +1,104 @@
-import { getGeneralApiProblem } from "./api-problem"
-import { ApiErrorResponse } from "apisauce"
+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",
+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",
+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",
+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 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",
+test('handles unknown errors', () => {
+ expect(
+ getGeneralApiProblem({
+ problem: 'UNKNOWN_ERROR',
+ } as ApiErrorResponse<null>),
+ ).toEqual({
+ kind: 'unknown',
temporary: true,
})
})
-test("handles unauthorized errors", () => {
+test('handles unauthorized errors', () => {
expect(
- getGeneralApiProblem({ problem: "CLIENT_ERROR", status: 401 } as ApiErrorResponse<null>),
+ getGeneralApiProblem({
+ problem: 'CLIENT_ERROR',
+ status: 401,
+ } as ApiErrorResponse<null>),
).toEqual({
- kind: "unauthorized",
+ kind: 'unauthorized',
})
})
-test("handles forbidden errors", () => {
+test('handles forbidden errors', () => {
expect(
- getGeneralApiProblem({ problem: "CLIENT_ERROR", status: 403 } as ApiErrorResponse<null>),
+ getGeneralApiProblem({
+ problem: 'CLIENT_ERROR',
+ status: 403,
+ } as ApiErrorResponse<null>),
).toEqual({
- kind: "forbidden",
+ kind: 'forbidden',
})
})
-test("handles not-found errors", () => {
+test('handles not-found errors', () => {
expect(
- getGeneralApiProblem({ problem: "CLIENT_ERROR", status: 404 } as ApiErrorResponse<null>),
+ getGeneralApiProblem({
+ problem: 'CLIENT_ERROR',
+ status: 404,
+ } as ApiErrorResponse<null>),
).toEqual({
- kind: "not-found",
+ kind: 'not-found',
})
})
-test("handles other client errors", () => {
+test('handles other client errors', () => {
expect(
- getGeneralApiProblem({ problem: "CLIENT_ERROR", status: 418 } as ApiErrorResponse<null>),
+ getGeneralApiProblem({
+ problem: 'CLIENT_ERROR',
+ status: 418,
+ } as ApiErrorResponse<null>),
).toEqual({
- kind: "rejected",
+ kind: 'rejected',
})
})
-test("handles cancellation errors", () => {
- expect(getGeneralApiProblem({ problem: "CANCEL_ERROR" } as ApiErrorResponse<null>)).toBeNull()
+test('handles cancellation errors', () => {
+ expect(
+ getGeneralApiProblem({ problem: 'CANCEL_ERROR' } as ApiErrorResponse<null>),
+ ).toBeNull()
})