From 9a208984b6a0674966e21fc38698eca7efd7b057 Mon Sep 17 00:00:00 2001 From: Mathieu KIM ROBIN Date: Fri, 28 Jun 2024 11:29:05 +0200 Subject: [PATCH] feat(version): bump --- README.md | 2 +- src/index.test.ts | 12839 ++++++++++++++++++++++---------------------- src/index.ts | 229 +- 3 files changed, 6582 insertions(+), 6488 deletions(-) diff --git a/README.md b/README.md index ee92628..d077c59 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -![Static Badge](https://img.shields.io/badge/coverage-100-brightgreen) +![Static Badge](https://img.shields.io/badge/coverage-99.4-brightgreen) ![Static Badge](https://img.shields.io/badge/release-4.1.0-blue) [![test](https://github.com/mathrobin/lambda-returns/actions/workflows/test.yml/badge.svg)](https://github.com/mathrobin/lambda-returns/actions/workflows/test.yml) diff --git a/src/index.test.ts b/src/index.test.ts index 53132be..0819022 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -1,4 +1,4 @@ -import { describe, expect, test } from 'vitest'; +import { beforeEach, describe, expect, test } from 'vitest'; import { accepted, badGateway, @@ -102,6 +102,7 @@ import { resetContent, seeOther, serviceUnavailable, + setAutoSerialize, switchingProtocols, temporaryRedirect, tooManyRequests, @@ -115,7975 +116,8059 @@ import { } from '@/src'; import randomInteger from '@/src/random_integer'; -describe('continue', () => { - test('should return 100 when empty args', () => { - expect(httpContinue()).toEqual({ - statusCode: 100, - headers: {}, - body: null, - }); - }); - - test('should return 100 when empty body but headers filled', () => { - expect( - httpContinue(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 100, - headers: { ContentType: 'application/json' }, - body: null, - }); +describe('lambda-returns', () => { + beforeEach(() => { + setAutoSerialize(true); }); - test('should return 100 when has obect body, no headers', () => { - expect(httpContinue({ status: 'success' })).toEqual({ - statusCode: 100, - headers: {}, - body: '{"status":"success"}', + describe('continue', () => { + test('should return 100 when empty args', () => { + expect(httpContinue()).toEqual({ + statusCode: 100, + headers: {}, + body: null, + }); }); - }); - test('should return 100 when has string body, no headers', () => { - expect(httpContinue('{"status":"success"}')).toEqual({ - statusCode: 100, - headers: {}, - body: '{"status":"success"}', + test('should return 100 when empty body but headers filled', () => { + expect( + httpContinue(undefined, { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 100, + headers: { ContentType: 'application/json' }, + body: null, + }); }); - }); - test('should return 100 when has obect body & headers', () => { - expect( - httpContinue( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 100, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should return 100 when has obect body, no headers', () => { + expect(httpContinue({ status: 'success' })).toEqual({ + statusCode: 100, + headers: {}, + body: '{"status":"success"}', + }); }); - }); - test('should return 100 when has string body & headers', () => { - expect( - httpContinue('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 100, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should return 100 when has obect body + no serialize, no headers', () => { + setAutoSerialize(false); + expect(httpContinue({ status: 'success' })).toEqual({ + statusCode: 100, + headers: {}, + body: { status: 'success' }, + }); }); - }); -}); -describe('isContinue', () => { - test('should be truthy when empty except code', () => { - expect( - isContinue({ + test('should return 100 when has string body, no headers', () => { + expect(httpContinue('{"status":"success"}')).toEqual({ statusCode: 100, - }) - ).toEqual(true); - }); + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be truthy when body filled, empty headers', () => { - expect( - isContinue({ + test('should return 100 when has obect body & headers', () => { + expect( + httpContinue( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ statusCode: 100, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(true); - }); + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isContinue({ + test('should return 100 when has string body & headers', () => { + expect( + httpContinue('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 100, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); - - test('should be truthy when fully filled', () => { - expect( - isContinue({ - statusCode: 100, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); + }); + }); }); - test('should be falsy when code empty', () => { - expect(isContinue({})).toEqual(false); - }); + describe('isContinue', () => { + test('should be truthy when empty except code', () => { + expect( + isContinue({ + statusCode: 100, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code', () => { - expect( - isContinue({ - statusCode: randomInteger(100), - }) - ).toEqual(false); - }); + test('should be truthy when body filled, empty headers', () => { + expect( + isContinue({ + statusCode: 100, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isContinue({ - statusCode: randomInteger(100), - body: '{"status":"success"}', - }) - ).toEqual(false); - }); + test('should be truthy when body empty, filled headers', () => { + expect( + isContinue({ + statusCode: 100, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isContinue({ - statusCode: randomInteger(100), - headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); + test('should be truthy when fully filled', () => { + expect( + isContinue({ + statusCode: 100, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + fully filled', () => { - expect( - isContinue({ - statusCode: randomInteger(100), - body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); - }); -}); + test('should be falsy when code empty', () => { + expect(isContinue({})).toEqual(false); + }); -describe('switchingProtocols', () => { - test('should return 101 when empty args', () => { - expect(switchingProtocols()).toEqual({ - statusCode: 101, - headers: {}, - body: null, + test('should be falsy when wrong code', () => { + expect( + isContinue({ + statusCode: randomInteger(100), + }) + ).toEqual(false); }); - }); - test('should return 101 when empty body but headers filled', () => { - expect( - switchingProtocols(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 101, - headers: { ContentType: 'application/json' }, - body: null, + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isContinue({ + statusCode: randomInteger(100), + body: '{"status":"success"}', + }) + ).toEqual(false); }); - }); - test('should return 101 when has obect body, no headers', () => { - expect(switchingProtocols({ status: 'success' })).toEqual({ - statusCode: 101, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isContinue({ + statusCode: randomInteger(100), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); - test('should return 101 when has string body, no headers', () => { - expect(switchingProtocols('{"status":"success"}')).toEqual({ - statusCode: 101, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code + fully filled', () => { + expect( + isContinue({ + statusCode: randomInteger(100), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); }); }); - test('should return 101 when has obect body & headers', () => { - expect( - switchingProtocols( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 101, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + describe('switchingProtocols', () => { + test('should return 101 when empty args', () => { + expect(switchingProtocols()).toEqual({ + statusCode: 101, + headers: {}, + body: null, + }); }); - }); - test('should return 101 when has string body & headers', () => { - expect( - switchingProtocols('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 101, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should return 101 when empty body but headers filled', () => { + expect( + switchingProtocols(undefined, { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 101, + headers: { ContentType: 'application/json' }, + body: null, + }); }); - }); -}); -describe('isSwitchingProtocols', () => { - test('should be truthy when empty except code', () => { - expect( - isSwitchingProtocols({ + test('should return 101 when has obect body, no headers', () => { + expect(switchingProtocols({ status: 'success' })).toEqual({ statusCode: 101, - }) - ).toEqual(true); - }); + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be truthy when body filled, empty headers', () => { - expect( - isSwitchingProtocols({ + test('should return 101 when has string body, no headers', () => { + expect(switchingProtocols('{"status":"success"}')).toEqual({ statusCode: 101, + headers: {}, body: '{"status":"success"}', - }) - ).toEqual(true); - }); + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isSwitchingProtocols({ + test('should return 101 when has obect body & headers', () => { + expect( + switchingProtocols( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ statusCode: 101, - headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, + body: '{"status":"success"}', + }); + }); + + test('should return 101 when has obect body & headers', () => { + setAutoSerialize(false); + expect( + switchingProtocols( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 101, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, + body: { status: 'success' }, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isSwitchingProtocols({ + test('should return 101 when has string body & headers', () => { + expect( + switchingProtocols('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 101, + headers: { ContentType: 'application/json' }, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isSwitchingProtocols({})).toEqual(false); + }); + }); }); - test('should be falsy when wrong code', () => { - expect( - isSwitchingProtocols({ - statusCode: randomInteger(101), - }) - ).toEqual(false); - }); + describe('isSwitchingProtocols', () => { + test('should be truthy when empty except code', () => { + expect( + isSwitchingProtocols({ + statusCode: 101, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isSwitchingProtocols({ - statusCode: randomInteger(101), - body: '{"status":"success"}', - }) - ).toEqual(false); - }); + test('should be truthy when body filled, empty headers', () => { + expect( + isSwitchingProtocols({ + statusCode: 101, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isSwitchingProtocols({ - statusCode: randomInteger(101), - headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); + test('should be truthy when body empty, filled headers', () => { + expect( + isSwitchingProtocols({ + statusCode: 101, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + fully filled', () => { - expect( - isSwitchingProtocols({ - statusCode: randomInteger(101), - body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); - }); -}); + test('should be truthy when fully filled', () => { + expect( + isSwitchingProtocols({ + statusCode: 101, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); + }); -describe('processing', () => { - test('should return 102 when empty args', () => { - expect(processing()).toEqual({ - statusCode: 102, - headers: {}, - body: null, + test('should be falsy when code empty', () => { + expect(isSwitchingProtocols({})).toEqual(false); }); - }); - test('should return 102 when empty body but headers filled', () => { - expect(processing(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 102, - headers: { ContentType: 'application/json' }, - body: null, + test('should be falsy when wrong code', () => { + expect( + isSwitchingProtocols({ + statusCode: randomInteger(101), + }) + ).toEqual(false); }); - }); - test('should return 102 when has obect body, no headers', () => { - expect(processing({ status: 'success' })).toEqual({ - statusCode: 102, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isSwitchingProtocols({ + statusCode: randomInteger(101), + body: '{"status":"success"}', + }) + ).toEqual(false); }); - }); - test('should return 102 when has string body, no headers', () => { - expect(processing('{"status":"success"}')).toEqual({ - statusCode: 102, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isSwitchingProtocols({ + statusCode: randomInteger(101), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); - test('should return 102 when has obect body & headers', () => { - expect( - processing( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 102, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when wrong code + fully filled', () => { + expect( + isSwitchingProtocols({ + statusCode: randomInteger(101), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); }); }); - test('should return 102 when has string body & headers', () => { - expect( - processing('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 102, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + describe('processing', () => { + test('should return 102 when empty args', () => { + expect(processing()).toEqual({ + statusCode: 102, + headers: {}, + body: null, + }); }); - }); -}); -describe('isProcessing', () => { - test('should be truthy when empty except code', () => { - expect( - isProcessing({ + test('should return 102 when empty body but headers filled', () => { + expect( + processing(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 102, - }) - ).toEqual(true); - }); + headers: { ContentType: 'application/json' }, + body: null, + }); + }); - test('should be truthy when body filled, empty headers', () => { - expect( - isProcessing({ + test('should return 102 when has obect body, no headers', () => { + expect(processing({ status: 'success' })).toEqual({ statusCode: 102, + headers: {}, body: '{"status":"success"}', - }) - ).toEqual(true); - }); + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isProcessing({ + test('should return 102 when has string body, no headers', () => { + expect(processing('{"status":"success"}')).toEqual({ statusCode: 102, - headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be truthy when fully filled', () => { - expect( - isProcessing({ + test('should return 102 when has obect body & headers', () => { + expect( + processing( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ statusCode: 102, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isProcessing({})).toEqual(false); - }); - - test('should be falsy when wrong code', () => { - expect( - isProcessing({ - statusCode: randomInteger(102), - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isProcessing({ - statusCode: randomInteger(102), + test('should return 102 when has string body & headers', () => { + expect( + processing('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 102, + headers: { ContentType: 'application/json' }, body: '{"status":"success"}', - }) - ).toEqual(false); + }); + }); }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isProcessing({ - statusCode: randomInteger(102), - headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); + describe('isProcessing', () => { + test('should be truthy when empty except code', () => { + expect( + isProcessing({ + statusCode: 102, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + fully filled', () => { - expect( - isProcessing({ - statusCode: randomInteger(102), - body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); - }); -}); + test('should be truthy when body filled, empty headers', () => { + expect( + isProcessing({ + statusCode: 102, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); -describe('ok', () => { - test('should return 200 when empty args', () => { - expect(ok()).toEqual({ - statusCode: 200, - headers: {}, - body: null, + test('should be truthy when body empty, filled headers', () => { + expect( + isProcessing({ + statusCode: 102, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 200 when empty body but headers filled', () => { - expect(ok(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 200, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when fully filled', () => { + expect( + isProcessing({ + statusCode: 102, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 200 when has obect body, no headers', () => { - expect(ok({ status: 'success' })).toEqual({ - statusCode: 200, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isProcessing({})).toEqual(false); }); - }); - test('should return 200 when has string body, no headers', () => { - expect(ok('{"status":"success"}')).toEqual({ - statusCode: 200, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isProcessing({ + statusCode: randomInteger(102), + }) + ).toEqual(false); }); - }); - test('should return 200 when has obect body & headers', () => { - expect( - ok( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 200, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isProcessing({ + statusCode: randomInteger(102), + body: '{"status":"success"}', + }) + ).toEqual(false); }); - }); - test('should return 200 when has string body & headers', () => { - expect( - ok('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 200, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isProcessing({ + statusCode: randomInteger(102), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); -}); -describe('isOk', () => { - test('should be truthy when empty except code', () => { - expect( - isOk({ - statusCode: 200, - }) - ).toEqual(true); + test('should be falsy when wrong code + fully filled', () => { + expect( + isProcessing({ + statusCode: randomInteger(102), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isOk({ + describe('ok', () => { + test('should return 200 when empty args', () => { + expect(ok()).toEqual({ statusCode: 200, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isOk({ + test('should return 200 when empty body but headers filled', () => { + expect(ok(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 200, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isOk({ + test('should return 200 when has obect body, no headers', () => { + expect(ok({ status: 'success' })).toEqual({ statusCode: 200, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isOk({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isOk({ - statusCode: randomInteger(200), - }) - ).toEqual(false); - }); + test('should return 200 when has string body, no headers', () => { + expect(ok('{"status":"success"}')).toEqual({ + statusCode: 200, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isOk({ - statusCode: randomInteger(200), + test('should return 200 when has obect body & headers', () => { + expect( + ok( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 200, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isOk({ - statusCode: randomInteger(200), + test('should return 200 when has string body & headers', () => { + expect( + ok('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 200, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isOk({ - statusCode: randomInteger(200), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('created', () => { - test('should return 201 when empty args', () => { - expect(created()).toEqual({ - statusCode: 201, - headers: {}, - body: null, + describe('isOk', () => { + test('should be truthy when empty except code', () => { + expect( + isOk({ + statusCode: 200, + }) + ).toEqual(true); }); - }); - test('should return 201 when empty body but headers filled', () => { - expect(created(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 201, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isOk({ + statusCode: 200, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 201 when has obect body, no headers', () => { - expect(created({ status: 'success' })).toEqual({ - statusCode: 201, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isOk({ + statusCode: 200, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 201 when has string body, no headers', () => { - expect(created('{"status":"success"}')).toEqual({ - statusCode: 201, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isOk({ + statusCode: 200, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 201 when has obect body & headers', () => { - expect( - created( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 201, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isOk({})).toEqual(false); }); - }); - test('should return 201 when has string body & headers', () => { - expect( - created('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 201, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isOk({ + statusCode: randomInteger(200), + }) + ).toEqual(false); }); - }); -}); -describe('isCreated', () => { - test('should be truthy when empty except code', () => { - expect( - isCreated({ - statusCode: 201, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isOk({ + statusCode: randomInteger(200), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isOk({ + statusCode: randomInteger(200), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isOk({ + statusCode: randomInteger(200), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isCreated({ + describe('created', () => { + test('should return 201 when empty args', () => { + expect(created()).toEqual({ statusCode: 201, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isCreated({ + test('should return 201 when empty body but headers filled', () => { + expect(created(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 201, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isCreated({ + test('should return 201 when has obect body, no headers', () => { + expect(created({ status: 'success' })).toEqual({ statusCode: 201, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isCreated({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isCreated({ - statusCode: randomInteger(201), - }) - ).toEqual(false); - }); + test('should return 201 when has string body, no headers', () => { + expect(created('{"status":"success"}')).toEqual({ + statusCode: 201, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isCreated({ - statusCode: randomInteger(201), + test('should return 201 when has obect body & headers', () => { + expect( + created( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 201, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isCreated({ - statusCode: randomInteger(201), + test('should return 201 when has string body & headers', () => { + expect( + created('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 201, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isCreated({ - statusCode: randomInteger(201), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('accepted', () => { - test('should return 202 when empty args', () => { - expect(accepted()).toEqual({ - statusCode: 202, - headers: {}, - body: null, + describe('isCreated', () => { + test('should be truthy when empty except code', () => { + expect( + isCreated({ + statusCode: 201, + }) + ).toEqual(true); }); - }); - test('should return 202 when empty body but headers filled', () => { - expect(accepted(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 202, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isCreated({ + statusCode: 201, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 202 when has obect body, no headers', () => { - expect(accepted({ status: 'success' })).toEqual({ - statusCode: 202, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isCreated({ + statusCode: 201, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 202 when has string body, no headers', () => { - expect(accepted('{"status":"success"}')).toEqual({ - statusCode: 202, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isCreated({ + statusCode: 201, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 202 when has obect body & headers', () => { - expect( - accepted( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 202, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isCreated({})).toEqual(false); }); - }); - test('should return 202 when has string body & headers', () => { - expect( - accepted('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 202, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isCreated({ + statusCode: randomInteger(201), + }) + ).toEqual(false); }); - }); -}); -describe('isAccepted', () => { - test('should be truthy when empty except code', () => { - expect( - isAccepted({ - statusCode: 202, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isCreated({ + statusCode: randomInteger(201), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isCreated({ + statusCode: randomInteger(201), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isCreated({ + statusCode: randomInteger(201), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isAccepted({ + describe('accepted', () => { + test('should return 202 when empty args', () => { + expect(accepted()).toEqual({ statusCode: 202, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isAccepted({ + test('should return 202 when empty body but headers filled', () => { + expect(accepted(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 202, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isAccepted({ + test('should return 202 when has obect body, no headers', () => { + expect(accepted({ status: 'success' })).toEqual({ statusCode: 202, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isAccepted({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isAccepted({ - statusCode: randomInteger(202), - }) - ).toEqual(false); - }); + test('should return 202 when has string body, no headers', () => { + expect(accepted('{"status":"success"}')).toEqual({ + statusCode: 202, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isAccepted({ - statusCode: randomInteger(202), + test('should return 202 when has obect body & headers', () => { + expect( + accepted( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 202, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isAccepted({ - statusCode: randomInteger(202), + test('should return 202 when has string body & headers', () => { + expect( + accepted('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 202, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isAccepted({ - statusCode: randomInteger(202), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('nonAuthoritativeInformation', () => { - test('should return 203 when empty args', () => { - expect(nonAuthoritativeInformation()).toEqual({ - statusCode: 203, - headers: {}, - body: null, + describe('isAccepted', () => { + test('should be truthy when empty except code', () => { + expect( + isAccepted({ + statusCode: 202, + }) + ).toEqual(true); }); - }); - test('should return 203 when empty body but headers filled', () => { - expect( - nonAuthoritativeInformation(undefined, { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 203, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isAccepted({ + statusCode: 202, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 203 when has obect body, no headers', () => { - expect(nonAuthoritativeInformation({ status: 'success' })).toEqual({ - statusCode: 203, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isAccepted({ + statusCode: 202, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 203 when has string body, no headers', () => { - expect(nonAuthoritativeInformation('{"status":"success"}')).toEqual({ - statusCode: 203, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isAccepted({ + statusCode: 202, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 203 when has obect body & headers', () => { - expect( - nonAuthoritativeInformation( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 203, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isAccepted({})).toEqual(false); }); - }); - test('should return 203 when has string body & headers', () => { - expect( - nonAuthoritativeInformation('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 203, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isAccepted({ + statusCode: randomInteger(202), + }) + ).toEqual(false); }); - }); -}); -describe('isNonAuthoritativeInformation', () => { - test('should be truthy when empty except code', () => { - expect( - isNonAuthoritativeInformation({ - statusCode: 203, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isAccepted({ + statusCode: randomInteger(202), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isAccepted({ + statusCode: randomInteger(202), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isAccepted({ + statusCode: randomInteger(202), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNonAuthoritativeInformation({ + describe('nonAuthoritativeInformation', () => { + test('should return 203 when empty args', () => { + expect(nonAuthoritativeInformation()).toEqual({ statusCode: 203, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNonAuthoritativeInformation({ + test('should return 203 when empty body but headers filled', () => { + expect( + nonAuthoritativeInformation(undefined, { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 203, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNonAuthoritativeInformation({ + test('should return 203 when has obect body, no headers', () => { + expect(nonAuthoritativeInformation({ status: 'success' })).toEqual({ statusCode: 203, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNonAuthoritativeInformation({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNonAuthoritativeInformation({ - statusCode: randomInteger(203), - }) - ).toEqual(false); - }); + test('should return 203 when has string body, no headers', () => { + expect(nonAuthoritativeInformation('{"status":"success"}')).toEqual({ + statusCode: 203, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNonAuthoritativeInformation({ - statusCode: randomInteger(203), + test('should return 203 when has obect body & headers', () => { + expect( + nonAuthoritativeInformation( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 203, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNonAuthoritativeInformation({ - statusCode: randomInteger(203), + test('should return 203 when has string body & headers', () => { + expect( + nonAuthoritativeInformation('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 203, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isNonAuthoritativeInformation({ - statusCode: randomInteger(203), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('resetContent', () => { - test('should return 205 when empty args', () => { - expect(resetContent()).toEqual({ - statusCode: 205, - headers: {}, - body: null, + describe('isNonAuthoritativeInformation', () => { + test('should be truthy when empty except code', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: 203, + }) + ).toEqual(true); }); - }); - test('should return 205 when empty body but headers filled', () => { - expect( - resetContent(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 205, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: 203, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 205 when has obect body, no headers', () => { - expect(resetContent({ status: 'success' })).toEqual({ - statusCode: 205, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: 203, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 205 when has string body, no headers', () => { - expect(resetContent('{"status":"success"}')).toEqual({ - statusCode: 205, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: 203, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 205 when has obect body & headers', () => { - expect( - resetContent( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 205, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isNonAuthoritativeInformation({})).toEqual(false); }); - }); - test('should return 205 when has string body & headers', () => { - expect( - resetContent('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 205, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: randomInteger(203), + }) + ).toEqual(false); }); - }); -}); -describe('isResetContent', () => { - test('should be truthy when empty except code', () => { - expect( - isResetContent({ - statusCode: 205, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: randomInteger(203), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: randomInteger(203), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNonAuthoritativeInformation({ + statusCode: randomInteger(203), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isResetContent({ + describe('resetContent', () => { + test('should return 205 when empty args', () => { + expect(resetContent()).toEqual({ statusCode: 205, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isResetContent({ + test('should return 205 when empty body but headers filled', () => { + expect( + resetContent(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 205, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isResetContent({ + test('should return 205 when has obect body, no headers', () => { + expect(resetContent({ status: 'success' })).toEqual({ statusCode: 205, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isResetContent({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isResetContent({ - statusCode: randomInteger(205), - }) - ).toEqual(false); - }); + test('should return 205 when has string body, no headers', () => { + expect(resetContent('{"status":"success"}')).toEqual({ + statusCode: 205, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isResetContent({ - statusCode: randomInteger(205), + test('should return 205 when has obect body & headers', () => { + expect( + resetContent( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 205, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isResetContent({ - statusCode: randomInteger(205), + test('should return 205 when has string body & headers', () => { + expect( + resetContent('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 205, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isResetContent({ - statusCode: randomInteger(205), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('partialContent', () => { - test('should return 206 when empty args', () => { - expect(partialContent()).toEqual({ - statusCode: 206, - headers: {}, - body: null, + describe('isResetContent', () => { + test('should be truthy when empty except code', () => { + expect( + isResetContent({ + statusCode: 205, + }) + ).toEqual(true); }); - }); - test('should return 206 when empty body but headers filled', () => { - expect( - partialContent(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 206, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isResetContent({ + statusCode: 205, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 206 when has obect body, no headers', () => { - expect(partialContent({ status: 'success' })).toEqual({ - statusCode: 206, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isResetContent({ + statusCode: 205, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 206 when has string body, no headers', () => { - expect(partialContent('{"status":"success"}')).toEqual({ - statusCode: 206, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isResetContent({ + statusCode: 205, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 206 when has obect body & headers', () => { - expect( - partialContent( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 206, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isResetContent({})).toEqual(false); }); - }); - test('should return 206 when has string body & headers', () => { - expect( - partialContent('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 206, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isResetContent({ + statusCode: randomInteger(205), + }) + ).toEqual(false); }); - }); -}); -describe('isPartialContent', () => { - test('should be truthy when empty except code', () => { - expect( - isPartialContent({ - statusCode: 206, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isResetContent({ + statusCode: randomInteger(205), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isResetContent({ + statusCode: randomInteger(205), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isResetContent({ + statusCode: randomInteger(205), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isPartialContent({ + describe('partialContent', () => { + test('should return 206 when empty args', () => { + expect(partialContent()).toEqual({ statusCode: 206, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isPartialContent({ + test('should return 206 when empty body but headers filled', () => { + expect( + partialContent(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 206, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isPartialContent({ + test('should return 206 when has obect body, no headers', () => { + expect(partialContent({ status: 'success' })).toEqual({ statusCode: 206, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isPartialContent({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isPartialContent({ - statusCode: randomInteger(206), - }) - ).toEqual(false); - }); + test('should return 206 when has string body, no headers', () => { + expect(partialContent('{"status":"success"}')).toEqual({ + statusCode: 206, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isPartialContent({ - statusCode: randomInteger(206), + test('should return 206 when has obect body & headers', () => { + expect( + partialContent( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 206, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isPartialContent({ - statusCode: randomInteger(206), + test('should return 206 when has string body & headers', () => { + expect( + partialContent('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 206, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isPartialContent({ - statusCode: randomInteger(206), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('multiStatus', () => { - test('should return 207 when empty args', () => { - expect(multiStatus()).toEqual({ - statusCode: 207, - headers: {}, - body: null, + describe('isPartialContent', () => { + test('should be truthy when empty except code', () => { + expect( + isPartialContent({ + statusCode: 206, + }) + ).toEqual(true); }); - }); - test('should return 207 when empty body but headers filled', () => { - expect(multiStatus(undefined, { ContentType: 'application/json' })).toEqual( - { - statusCode: 207, - headers: { ContentType: 'application/json' }, - body: null, - } - ); - }); + test('should be truthy when body filled, empty headers', () => { + expect( + isPartialContent({ + statusCode: 206, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); - test('should return 207 when has obect body, no headers', () => { - expect(multiStatus({ status: 'success' })).toEqual({ - statusCode: 207, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isPartialContent({ + statusCode: 206, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 207 when has string body, no headers', () => { - expect(multiStatus('{"status":"success"}')).toEqual({ - statusCode: 207, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isPartialContent({ + statusCode: 206, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 207 when has obect body & headers', () => { - expect( - multiStatus( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 207, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isPartialContent({})).toEqual(false); }); - }); - test('should return 207 when has string body & headers', () => { - expect( - multiStatus('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 207, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isPartialContent({ + statusCode: randomInteger(206), + }) + ).toEqual(false); }); - }); -}); -describe('isMultiStatus', () => { - test('should be truthy when empty except code', () => { - expect( - isMultiStatus({ - statusCode: 207, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isPartialContent({ + statusCode: randomInteger(206), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isPartialContent({ + statusCode: randomInteger(206), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isPartialContent({ + statusCode: randomInteger(206), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isMultiStatus({ + describe('multiStatus', () => { + test('should return 207 when empty args', () => { + expect(multiStatus()).toEqual({ statusCode: 207, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isMultiStatus({ + test('should return 207 when empty body but headers filled', () => { + expect( + multiStatus(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 207, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isMultiStatus({ + test('should return 207 when has obect body, no headers', () => { + expect(multiStatus({ status: 'success' })).toEqual({ statusCode: 207, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isMultiStatus({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isMultiStatus({ - statusCode: randomInteger(207), - }) - ).toEqual(false); - }); + test('should return 207 when has string body, no headers', () => { + expect(multiStatus('{"status":"success"}')).toEqual({ + statusCode: 207, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isMultiStatus({ - statusCode: randomInteger(207), + test('should return 207 when has obect body & headers', () => { + expect( + multiStatus( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 207, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isMultiStatus({ - statusCode: randomInteger(207), + test('should return 207 when has string body & headers', () => { + expect( + multiStatus('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 207, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isMultiStatus({ - statusCode: randomInteger(207), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('multipleChoices', () => { - test('should return 300 when empty args', () => { - expect(multipleChoices()).toEqual({ - statusCode: 300, - headers: {}, - body: null, + describe('isMultiStatus', () => { + test('should be truthy when empty except code', () => { + expect( + isMultiStatus({ + statusCode: 207, + }) + ).toEqual(true); }); - }); - test('should return 300 when empty body but headers filled', () => { - expect( - multipleChoices(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 300, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isMultiStatus({ + statusCode: 207, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 300 when has obect body, no headers', () => { - expect(multipleChoices({ status: 'success' })).toEqual({ - statusCode: 300, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isMultiStatus({ + statusCode: 207, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 300 when has string body, no headers', () => { - expect(multipleChoices('{"status":"success"}')).toEqual({ - statusCode: 300, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isMultiStatus({ + statusCode: 207, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 300 when has obect body & headers', () => { - expect( - multipleChoices( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 300, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isMultiStatus({})).toEqual(false); }); - }); - test('should return 300 when has string body & headers', () => { - expect( - multipleChoices('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 300, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isMultiStatus({ + statusCode: randomInteger(207), + }) + ).toEqual(false); }); - }); -}); -describe('isMultipleChoices', () => { - test('should be truthy when empty except code', () => { - expect( - isMultipleChoices({ - statusCode: 300, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isMultiStatus({ + statusCode: randomInteger(207), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isMultiStatus({ + statusCode: randomInteger(207), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isMultiStatus({ + statusCode: randomInteger(207), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isMultipleChoices({ + describe('multipleChoices', () => { + test('should return 300 when empty args', () => { + expect(multipleChoices()).toEqual({ statusCode: 300, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isMultipleChoices({ + test('should return 300 when empty body but headers filled', () => { + expect( + multipleChoices(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 300, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isMultipleChoices({ + test('should return 300 when has obect body, no headers', () => { + expect(multipleChoices({ status: 'success' })).toEqual({ statusCode: 300, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isMultipleChoices({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isMultipleChoices({ - statusCode: randomInteger(300), - }) - ).toEqual(false); - }); + test('should return 300 when has string body, no headers', () => { + expect(multipleChoices('{"status":"success"}')).toEqual({ + statusCode: 300, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isMultipleChoices({ - statusCode: randomInteger(300), + test('should return 300 when has obect body & headers', () => { + expect( + multipleChoices( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 300, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isMultipleChoices({ - statusCode: randomInteger(300), + test('should return 300 when has string body & headers', () => { + expect( + multipleChoices('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 300, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isMultipleChoices({ - statusCode: randomInteger(300), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('movedPermanently', () => { - test('should return 301 when empty args', () => { - expect(movedPermanently()).toEqual({ - statusCode: 301, - headers: {}, - body: null, + describe('isMultipleChoices', () => { + test('should be truthy when empty except code', () => { + expect( + isMultipleChoices({ + statusCode: 300, + }) + ).toEqual(true); }); - }); - test('should return 301 when empty body but headers filled', () => { - expect( - movedPermanently(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 301, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isMultipleChoices({ + statusCode: 300, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 301 when has obect body, no headers', () => { - expect(movedPermanently({ status: 'success' })).toEqual({ - statusCode: 301, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isMultipleChoices({ + statusCode: 300, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 301 when has string body, no headers', () => { - expect(movedPermanently('{"status":"success"}')).toEqual({ - statusCode: 301, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isMultipleChoices({ + statusCode: 300, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 301 when has obect body & headers', () => { - expect( - movedPermanently( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 301, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isMultipleChoices({})).toEqual(false); }); - }); - test('should return 301 when has string body & headers', () => { - expect( - movedPermanently('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 301, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isMultipleChoices({ + statusCode: randomInteger(300), + }) + ).toEqual(false); }); - }); -}); -describe('isMovedPermanently', () => { - test('should be truthy when empty except code', () => { - expect( - isMovedPermanently({ - statusCode: 301, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isMultipleChoices({ + statusCode: randomInteger(300), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isMultipleChoices({ + statusCode: randomInteger(300), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isMultipleChoices({ + statusCode: randomInteger(300), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isMovedPermanently({ + describe('movedPermanently', () => { + test('should return 301 when empty args', () => { + expect(movedPermanently()).toEqual({ statusCode: 301, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isMovedPermanently({ + test('should return 301 when empty body but headers filled', () => { + expect( + movedPermanently(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 301, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isMovedPermanently({ + test('should return 301 when has obect body, no headers', () => { + expect(movedPermanently({ status: 'success' })).toEqual({ statusCode: 301, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isMovedPermanently({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isMovedPermanently({ - statusCode: randomInteger(301), - }) - ).toEqual(false); - }); + test('should return 301 when has string body, no headers', () => { + expect(movedPermanently('{"status":"success"}')).toEqual({ + statusCode: 301, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isMovedPermanently({ - statusCode: randomInteger(301), + test('should return 301 when has obect body & headers', () => { + expect( + movedPermanently( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 301, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isMovedPermanently({ - statusCode: randomInteger(301), + test('should return 301 when has string body & headers', () => { + expect( + movedPermanently('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 301, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isMovedPermanently({ - statusCode: randomInteger(301), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('movedTemporarily', () => { - test('should return 302 when empty args', () => { - expect(movedTemporarily()).toEqual({ - statusCode: 302, - headers: {}, - body: null, + describe('isMovedPermanently', () => { + test('should be truthy when empty except code', () => { + expect( + isMovedPermanently({ + statusCode: 301, + }) + ).toEqual(true); }); - }); - test('should return 302 when empty body but headers filled', () => { - expect( - movedTemporarily(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 302, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isMovedPermanently({ + statusCode: 301, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 302 when has obect body, no headers', () => { - expect(movedTemporarily({ status: 'success' })).toEqual({ - statusCode: 302, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isMovedPermanently({ + statusCode: 301, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 302 when has string body, no headers', () => { - expect(movedTemporarily('{"status":"success"}')).toEqual({ - statusCode: 302, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isMovedPermanently({ + statusCode: 301, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 302 when has obect body & headers', () => { - expect( - movedTemporarily( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 302, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isMovedPermanently({})).toEqual(false); }); - }); - test('should return 302 when has string body & headers', () => { - expect( - movedTemporarily('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 302, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isMovedPermanently({ + statusCode: randomInteger(301), + }) + ).toEqual(false); }); - }); -}); -describe('isMovedTemporarily', () => { - test('should be truthy when empty except code', () => { - expect( - isMovedTemporarily({ - statusCode: 302, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isMovedPermanently({ + statusCode: randomInteger(301), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isMovedPermanently({ + statusCode: randomInteger(301), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isMovedPermanently({ + statusCode: randomInteger(301), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isMovedTemporarily({ + describe('movedTemporarily', () => { + test('should return 302 when empty args', () => { + expect(movedTemporarily()).toEqual({ statusCode: 302, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isMovedTemporarily({ + test('should return 302 when empty body but headers filled', () => { + expect( + movedTemporarily(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 302, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isMovedTemporarily({ + test('should return 302 when has obect body, no headers', () => { + expect(movedTemporarily({ status: 'success' })).toEqual({ statusCode: 302, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isMovedTemporarily({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isMovedTemporarily({ - statusCode: randomInteger(302), - }) - ).toEqual(false); - }); + test('should return 302 when has string body, no headers', () => { + expect(movedTemporarily('{"status":"success"}')).toEqual({ + statusCode: 302, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isMovedTemporarily({ - statusCode: randomInteger(302), + test('should return 302 when has obect body & headers', () => { + expect( + movedTemporarily( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 302, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isMovedTemporarily({ - statusCode: randomInteger(302), + test('should return 302 when has string body & headers', () => { + expect( + movedTemporarily('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 302, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isMovedTemporarily({ - statusCode: randomInteger(302), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('seeOther', () => { - test('should return 303 when empty args', () => { - expect(seeOther()).toEqual({ - statusCode: 303, - headers: {}, - body: null, + describe('isMovedTemporarily', () => { + test('should be truthy when empty except code', () => { + expect( + isMovedTemporarily({ + statusCode: 302, + }) + ).toEqual(true); }); - }); - test('should return 303 when empty body but headers filled', () => { - expect(seeOther(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 303, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isMovedTemporarily({ + statusCode: 302, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 303 when has obect body, no headers', () => { - expect(seeOther({ status: 'success' })).toEqual({ - statusCode: 303, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isMovedTemporarily({ + statusCode: 302, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 303 when has string body, no headers', () => { - expect(seeOther('{"status":"success"}')).toEqual({ - statusCode: 303, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isMovedTemporarily({ + statusCode: 302, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 303 when has obect body & headers', () => { - expect( - seeOther( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 303, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isMovedTemporarily({})).toEqual(false); }); - }); - test('should return 303 when has string body & headers', () => { - expect( - seeOther('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 303, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isMovedTemporarily({ + statusCode: randomInteger(302), + }) + ).toEqual(false); }); - }); -}); -describe('isSeeOther', () => { - test('should be truthy when empty except code', () => { - expect( - isSeeOther({ - statusCode: 303, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isMovedTemporarily({ + statusCode: randomInteger(302), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isMovedTemporarily({ + statusCode: randomInteger(302), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isMovedTemporarily({ + statusCode: randomInteger(302), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isSeeOther({ + describe('seeOther', () => { + test('should return 303 when empty args', () => { + expect(seeOther()).toEqual({ statusCode: 303, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isSeeOther({ + test('should return 303 when empty body but headers filled', () => { + expect(seeOther(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 303, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isSeeOther({ + test('should return 303 when has obect body, no headers', () => { + expect(seeOther({ status: 'success' })).toEqual({ statusCode: 303, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isSeeOther({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isSeeOther({ - statusCode: randomInteger(303), - }) - ).toEqual(false); - }); + test('should return 303 when has string body, no headers', () => { + expect(seeOther('{"status":"success"}')).toEqual({ + statusCode: 303, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isSeeOther({ - statusCode: randomInteger(303), + test('should return 303 when has obect body & headers', () => { + expect( + seeOther( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 303, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isSeeOther({ - statusCode: randomInteger(303), + test('should return 303 when has string body & headers', () => { + expect( + seeOther('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 303, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isSeeOther({ - statusCode: randomInteger(303), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('noContent', () => { - test('should return 204 when empty args', () => { - expect(noContent()).toEqual({ - statusCode: 204, - headers: {}, + describe('isSeeOther', () => { + test('should be truthy when empty except code', () => { + expect( + isSeeOther({ + statusCode: 303, + }) + ).toEqual(true); }); - }); - test('should return 204 when headers filled', () => { - expect( - noContent({ ContentType: 'application/json', 'accept-charset': 'utf8' }) - ).toEqual({ - statusCode: 204, - headers: { ContentType: 'application/json', 'accept-charset': 'utf8' }, + test('should be truthy when body filled, empty headers', () => { + expect( + isSeeOther({ + statusCode: 303, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); -}); -describe('isNoContent', () => { - test('should be truthy when empty except code', () => { - expect( - isNoContent({ - statusCode: 204, - }) - ).toEqual(true); - }); + test('should be truthy when body empty, filled headers', () => { + expect( + isSeeOther({ + statusCode: 303, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNoContent({ - statusCode: 204, - headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + test('should be truthy when fully filled', () => { + expect( + isSeeOther({ + statusCode: 303, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); + }); - test('should be falsy when code empty', () => { - expect(isNoContent({})).toEqual(false); - }); + test('should be falsy when code empty', () => { + expect(isSeeOther({})).toEqual(false); + }); - test('should be falsy when wrong code', () => { - expect( - isNoContent({ - statusCode: randomInteger(204), - }) - ).toEqual(false); - }); + test('should be falsy when wrong code', () => { + expect( + isSeeOther({ + statusCode: randomInteger(303), + }) + ).toEqual(false); + }); - test('should be falsy when wrong code + filled headers', () => { - expect( - isNoContent({ - statusCode: randomInteger(204), - headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); -}); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isSeeOther({ + statusCode: randomInteger(303), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); -describe('notModified', () => { - test('should return 304 when empty args', () => { - expect(notModified()).toEqual({ - statusCode: 304, - headers: {}, - body: null, + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isSeeOther({ + statusCode: randomInteger(303), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); - test('should return 304 when empty body but headers filled', () => { - expect(notModified(undefined, { ContentType: 'application/json' })).toEqual( - { - statusCode: 304, - headers: { ContentType: 'application/json' }, - body: null, - } - ); + test('should be falsy when wrong code + fully filled', () => { + expect( + isSeeOther({ + statusCode: randomInteger(303), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should return 304 when has obect body, no headers', () => { - expect(notModified({ status: 'success' })).toEqual({ - statusCode: 304, - headers: {}, - body: '{"status":"success"}', + describe('noContent', () => { + test('should return 204 when empty args', () => { + expect(noContent()).toEqual({ + statusCode: 204, + headers: {}, + }); }); - }); - test('should return 304 when has string body, no headers', () => { - expect(notModified('{"status":"success"}')).toEqual({ - statusCode: 304, - headers: {}, - body: '{"status":"success"}', + test('should return 204 when headers filled', () => { + expect( + noContent({ ContentType: 'application/json', 'accept-charset': 'utf8' }) + ).toEqual({ + statusCode: 204, + headers: { ContentType: 'application/json', 'accept-charset': 'utf8' }, + }); }); }); - test('should return 304 when has obect body & headers', () => { - expect( - notModified( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 304, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + describe('isNoContent', () => { + test('should be truthy when empty except code', () => { + expect( + isNoContent({ + statusCode: 204, + }) + ).toEqual(true); }); - }); - test('should return 304 when has string body & headers', () => { - expect( - notModified('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 304, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNoContent({ + statusCode: 204, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); -}); -describe('isNotModified', () => { - test('should be truthy when empty except code', () => { - expect( - isNotModified({ - statusCode: 304, - }) - ).toEqual(true); + test('should be falsy when code empty', () => { + expect(isNoContent({})).toEqual(false); + }); + + test('should be falsy when wrong code', () => { + expect( + isNoContent({ + statusCode: randomInteger(204), + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + filled headers', () => { + expect( + isNoContent({ + statusCode: randomInteger(204), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNotModified({ + describe('notModified', () => { + test('should return 304 when empty args', () => { + expect(notModified()).toEqual({ statusCode: 304, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNotModified({ + test('should return 304 when empty body but headers filled', () => { + expect( + notModified(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 304, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNotModified({ + test('should return 304 when has obect body, no headers', () => { + expect(notModified({ status: 'success' })).toEqual({ statusCode: 304, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNotModified({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNotModified({ - statusCode: randomInteger(304), - }) - ).toEqual(false); - }); + test('should return 304 when has string body, no headers', () => { + expect(notModified('{"status":"success"}')).toEqual({ + statusCode: 304, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNotModified({ - statusCode: randomInteger(304), + test('should return 304 when has obect body & headers', () => { + expect( + notModified( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 304, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNotModified({ - statusCode: randomInteger(304), + test('should return 304 when has string body & headers', () => { + expect( + notModified('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 304, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isNotModified({ - statusCode: randomInteger(304), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('useProxy', () => { - test('should return 305 when empty args', () => { - expect(useProxy()).toEqual({ - statusCode: 305, - headers: {}, - body: null, + describe('isNotModified', () => { + test('should be truthy when empty except code', () => { + expect( + isNotModified({ + statusCode: 304, + }) + ).toEqual(true); }); - }); - test('should return 305 when empty body but headers filled', () => { - expect(useProxy(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 305, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isNotModified({ + statusCode: 304, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 305 when has obect body, no headers', () => { - expect(useProxy({ status: 'success' })).toEqual({ - statusCode: 305, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNotModified({ + statusCode: 304, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 305 when has string body, no headers', () => { - expect(useProxy('{"status":"success"}')).toEqual({ - statusCode: 305, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isNotModified({ + statusCode: 304, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 305 when has obect body & headers', () => { - expect( - useProxy( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 305, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isNotModified({})).toEqual(false); }); - }); - test('should return 305 when has string body & headers', () => { - expect( - useProxy('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 305, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isNotModified({ + statusCode: randomInteger(304), + }) + ).toEqual(false); }); - }); -}); -describe('isUseProxy', () => { - test('should be truthy when empty except code', () => { - expect( - isUseProxy({ - statusCode: 305, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNotModified({ + statusCode: randomInteger(304), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNotModified({ + statusCode: randomInteger(304), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNotModified({ + statusCode: randomInteger(304), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isUseProxy({ + describe('useProxy', () => { + test('should return 305 when empty args', () => { + expect(useProxy()).toEqual({ statusCode: 305, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isUseProxy({ + test('should return 305 when empty body but headers filled', () => { + expect(useProxy(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 305, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isUseProxy({ + test('should return 305 when has obect body, no headers', () => { + expect(useProxy({ status: 'success' })).toEqual({ statusCode: 305, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isUseProxy({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isUseProxy({ - statusCode: randomInteger(305), - }) - ).toEqual(false); - }); + test('should return 305 when has string body, no headers', () => { + expect(useProxy('{"status":"success"}')).toEqual({ + statusCode: 305, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isUseProxy({ - statusCode: randomInteger(305), + test('should return 305 when has obect body & headers', () => { + expect( + useProxy( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 305, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isUseProxy({ - statusCode: randomInteger(305), + test('should return 305 when has string body & headers', () => { + expect( + useProxy('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 305, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isUseProxy({ - statusCode: randomInteger(305), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('temporaryRedirect', () => { - test('should return 307 when empty args', () => { - expect(temporaryRedirect()).toEqual({ - statusCode: 307, - headers: {}, - body: null, + describe('isUseProxy', () => { + test('should be truthy when empty except code', () => { + expect( + isUseProxy({ + statusCode: 305, + }) + ).toEqual(true); }); - }); - test('should return 307 when empty body but headers filled', () => { - expect( - temporaryRedirect(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 307, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isUseProxy({ + statusCode: 305, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 307 when has obect body, no headers', () => { - expect(temporaryRedirect({ status: 'success' })).toEqual({ - statusCode: 307, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isUseProxy({ + statusCode: 305, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 307 when has string body, no headers', () => { - expect(temporaryRedirect('{"status":"success"}')).toEqual({ - statusCode: 307, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isUseProxy({ + statusCode: 305, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 307 when has obect body & headers', () => { - expect( - temporaryRedirect( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 307, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isUseProxy({})).toEqual(false); }); - }); - test('should return 307 when has string body & headers', () => { - expect( - temporaryRedirect('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 307, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isUseProxy({ + statusCode: randomInteger(305), + }) + ).toEqual(false); }); - }); -}); -describe('isTemporaryRedirect', () => { - test('should be truthy when empty except code', () => { - expect( - isTemporaryRedirect({ - statusCode: 307, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isUseProxy({ + statusCode: randomInteger(305), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isUseProxy({ + statusCode: randomInteger(305), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isUseProxy({ + statusCode: randomInteger(305), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isTemporaryRedirect({ + describe('temporaryRedirect', () => { + test('should return 307 when empty args', () => { + expect(temporaryRedirect()).toEqual({ statusCode: 307, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isTemporaryRedirect({ + test('should return 307 when empty body but headers filled', () => { + expect( + temporaryRedirect(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 307, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isTemporaryRedirect({ + test('should return 307 when has obect body, no headers', () => { + expect(temporaryRedirect({ status: 'success' })).toEqual({ statusCode: 307, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isTemporaryRedirect({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isTemporaryRedirect({ - statusCode: randomInteger(307), - }) - ).toEqual(false); - }); + test('should return 307 when has string body, no headers', () => { + expect(temporaryRedirect('{"status":"success"}')).toEqual({ + statusCode: 307, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isTemporaryRedirect({ - statusCode: randomInteger(307), + test('should return 307 when has obect body & headers', () => { + expect( + temporaryRedirect( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 307, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isTemporaryRedirect({ - statusCode: randomInteger(307), + test('should return 307 when has string body & headers', () => { + expect( + temporaryRedirect('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 307, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isTemporaryRedirect({ - statusCode: randomInteger(307), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('badRequest', () => { - test('should return 400 when empty args', () => { - expect(badRequest()).toEqual({ - statusCode: 400, - headers: {}, - body: null, + describe('isTemporaryRedirect', () => { + test('should be truthy when empty except code', () => { + expect( + isTemporaryRedirect({ + statusCode: 307, + }) + ).toEqual(true); }); - }); - test('should return 400 when empty body but headers filled', () => { - expect(badRequest(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 400, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isTemporaryRedirect({ + statusCode: 307, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 400 when has obect body, no headers', () => { - expect(badRequest({ status: 'success' })).toEqual({ - statusCode: 400, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isTemporaryRedirect({ + statusCode: 307, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 400 when has string body, no headers', () => { - expect(badRequest('{"status":"success"}')).toEqual({ - statusCode: 400, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isTemporaryRedirect({ + statusCode: 307, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 400 when has obect body & headers', () => { - expect( - badRequest( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 400, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isTemporaryRedirect({})).toEqual(false); }); - }); - test('should return 400 when has string body & headers', () => { - expect( - badRequest('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 400, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isTemporaryRedirect({ + statusCode: randomInteger(307), + }) + ).toEqual(false); }); - }); -}); -describe('isBadRequest', () => { - test('should be truthy when empty except code', () => { - expect( - isBadRequest({ - statusCode: 400, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isTemporaryRedirect({ + statusCode: randomInteger(307), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isTemporaryRedirect({ + statusCode: randomInteger(307), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isTemporaryRedirect({ + statusCode: randomInteger(307), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isBadRequest({ + describe('badRequest', () => { + test('should return 400 when empty args', () => { + expect(badRequest()).toEqual({ statusCode: 400, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isBadRequest({ + test('should return 400 when empty body but headers filled', () => { + expect( + badRequest(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 400, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isBadRequest({ + test('should return 400 when has obect body, no headers', () => { + expect(badRequest({ status: 'success' })).toEqual({ statusCode: 400, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isBadRequest({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isBadRequest({ - statusCode: randomInteger(400), - }) - ).toEqual(false); - }); + test('should return 400 when has string body, no headers', () => { + expect(badRequest('{"status":"success"}')).toEqual({ + statusCode: 400, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isBadRequest({ - statusCode: randomInteger(400), + test('should return 400 when has obect body & headers', () => { + expect( + badRequest( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 400, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isBadRequest({ - statusCode: randomInteger(400), + test('should return 400 when has string body & headers', () => { + expect( + badRequest('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 400, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isBadRequest({ - statusCode: randomInteger(400), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('unauthorized', () => { - test('should return 401 when empty args', () => { - expect(unauthorized()).toEqual({ - statusCode: 401, - headers: {}, - body: null, + describe('isBadRequest', () => { + test('should be truthy when empty except code', () => { + expect( + isBadRequest({ + statusCode: 400, + }) + ).toEqual(true); }); - }); - test('should return 401 when empty body but headers filled', () => { - expect( - unauthorized(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 401, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isBadRequest({ + statusCode: 400, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 401 when has obect body, no headers', () => { - expect(unauthorized({ status: 'success' })).toEqual({ - statusCode: 401, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isBadRequest({ + statusCode: 400, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 401 when has string body, no headers', () => { - expect(unauthorized('{"status":"success"}')).toEqual({ - statusCode: 401, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isBadRequest({ + statusCode: 400, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 401 when has obect body & headers', () => { - expect( - unauthorized( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 401, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isBadRequest({})).toEqual(false); }); - }); - test('should return 401 when has string body & headers', () => { - expect( - unauthorized('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 401, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isBadRequest({ + statusCode: randomInteger(400), + }) + ).toEqual(false); }); - }); -}); -describe('isUnauthorized', () => { - test('should be truthy when empty except code', () => { - expect( - isUnauthorized({ - statusCode: 401, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isBadRequest({ + statusCode: randomInteger(400), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isBadRequest({ + statusCode: randomInteger(400), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isBadRequest({ + statusCode: randomInteger(400), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isUnauthorized({ + describe('unauthorized', () => { + test('should return 401 when empty args', () => { + expect(unauthorized()).toEqual({ statusCode: 401, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isUnauthorized({ + test('should return 401 when empty body but headers filled', () => { + expect( + unauthorized(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 401, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isUnauthorized({ + test('should return 401 when has obect body, no headers', () => { + expect(unauthorized({ status: 'success' })).toEqual({ statusCode: 401, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isUnauthorized({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isUnauthorized({ - statusCode: randomInteger(401), - }) - ).toEqual(false); - }); + test('should return 401 when has string body, no headers', () => { + expect(unauthorized('{"status":"success"}')).toEqual({ + statusCode: 401, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isUnauthorized({ - statusCode: randomInteger(401), + test('should return 401 when has obect body & headers', () => { + expect( + unauthorized( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 401, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isUnauthorized({ - statusCode: randomInteger(401), + test('should return 401 when has string body & headers', () => { + expect( + unauthorized('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 401, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isUnauthorized({ - statusCode: randomInteger(401), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('paymentRequired', () => { - test('should return 402 when empty args', () => { - expect(paymentRequired()).toEqual({ - statusCode: 402, - headers: {}, - body: null, + describe('isUnauthorized', () => { + test('should be truthy when empty except code', () => { + expect( + isUnauthorized({ + statusCode: 401, + }) + ).toEqual(true); }); - }); - test('should return 402 when empty body but headers filled', () => { - expect( - paymentRequired(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 402, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isUnauthorized({ + statusCode: 401, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 402 when has obect body, no headers', () => { - expect(paymentRequired({ status: 'success' })).toEqual({ - statusCode: 402, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isUnauthorized({ + statusCode: 401, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 402 when has string body, no headers', () => { - expect(paymentRequired('{"status":"success"}')).toEqual({ - statusCode: 402, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isUnauthorized({ + statusCode: 401, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 402 when has obect body & headers', () => { - expect( - paymentRequired( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 402, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isUnauthorized({})).toEqual(false); }); - }); - test('should return 402 when has string body & headers', () => { - expect( - paymentRequired('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 402, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isUnauthorized({ + statusCode: randomInteger(401), + }) + ).toEqual(false); }); - }); -}); -describe('isPaymentRequired', () => { - test('should be truthy when empty except code', () => { - expect( - isPaymentRequired({ - statusCode: 402, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isUnauthorized({ + statusCode: randomInteger(401), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isUnauthorized({ + statusCode: randomInteger(401), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isUnauthorized({ + statusCode: randomInteger(401), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isPaymentRequired({ + describe('paymentRequired', () => { + test('should return 402 when empty args', () => { + expect(paymentRequired()).toEqual({ statusCode: 402, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isPaymentRequired({ + test('should return 402 when empty body but headers filled', () => { + expect( + paymentRequired(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 402, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isPaymentRequired({ + test('should return 402 when has obect body, no headers', () => { + expect(paymentRequired({ status: 'success' })).toEqual({ statusCode: 402, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isPaymentRequired({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isPaymentRequired({ - statusCode: randomInteger(402), - }) - ).toEqual(false); - }); + test('should return 402 when has string body, no headers', () => { + expect(paymentRequired('{"status":"success"}')).toEqual({ + statusCode: 402, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isPaymentRequired({ - statusCode: randomInteger(402), + test('should return 402 when has obect body & headers', () => { + expect( + paymentRequired( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 402, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isPaymentRequired({ - statusCode: randomInteger(402), + test('should return 402 when has string body & headers', () => { + expect( + paymentRequired('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 402, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isPaymentRequired({ - statusCode: randomInteger(402), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('forbidden', () => { - test('should return 403 when empty args', () => { - expect(forbidden()).toEqual({ - statusCode: 403, - headers: {}, - body: null, + describe('isPaymentRequired', () => { + test('should be truthy when empty except code', () => { + expect( + isPaymentRequired({ + statusCode: 402, + }) + ).toEqual(true); }); - }); - test('should return 403 when empty body but headers filled', () => { - expect(forbidden(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 403, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isPaymentRequired({ + statusCode: 402, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 403 when has obect body, no headers', () => { - expect(forbidden({ status: 'success' })).toEqual({ - statusCode: 403, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isPaymentRequired({ + statusCode: 402, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 403 when has string body, no headers', () => { - expect(forbidden('{"status":"success"}')).toEqual({ - statusCode: 403, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isPaymentRequired({ + statusCode: 402, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 403 when has obect body & headers', () => { - expect( - forbidden( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 403, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isPaymentRequired({})).toEqual(false); + }); + + test('should be falsy when wrong code', () => { + expect( + isPaymentRequired({ + statusCode: randomInteger(402), + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isPaymentRequired({ + statusCode: randomInteger(402), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isPaymentRequired({ + statusCode: randomInteger(402), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); - test('should return 403 when has string body & headers', () => { - expect( - forbidden('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 403, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code + fully filled', () => { + expect( + isPaymentRequired({ + statusCode: randomInteger(402), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); }); }); -}); -describe('isForbidden', () => { - test('should be truthy when empty except code', () => { - expect( - isForbidden({ + describe('forbidden', () => { + test('should return 403 when empty args', () => { + expect(forbidden()).toEqual({ statusCode: 403, - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); + + test('should return 403 when empty body but headers filled', () => { + expect(forbidden(undefined, { ContentType: 'application/json' })).toEqual( + { + statusCode: 403, + headers: { ContentType: 'application/json' }, + body: null, + } + ); + }); - test('should be truthy when body filled, empty headers', () => { - expect( - isForbidden({ + test('should return 403 when has obect body, no headers', () => { + expect(forbidden({ status: 'success' })).toEqual({ statusCode: 403, + headers: {}, body: '{"status":"success"}', - }) - ).toEqual(true); - }); + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isForbidden({ + test('should return 403 when has string body, no headers', () => { + expect(forbidden('{"status":"success"}')).toEqual({ statusCode: 403, - headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be truthy when fully filled', () => { - expect( - isForbidden({ + test('should return 403 when has obect body & headers', () => { + expect( + forbidden( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ statusCode: 403, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isForbidden({})).toEqual(false); - }); - - test('should be falsy when wrong code', () => { - expect( - isForbidden({ - statusCode: randomInteger(403), - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isForbidden({ - statusCode: randomInteger(403), + test('should return 403 when has string body & headers', () => { + expect( + forbidden('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 403, + headers: { ContentType: 'application/json' }, body: '{"status":"success"}', - }) - ).toEqual(false); + }); + }); }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isForbidden({ - statusCode: randomInteger(403), - headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); + describe('isForbidden', () => { + test('should be truthy when empty except code', () => { + expect( + isForbidden({ + statusCode: 403, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + fully filled', () => { - expect( - isForbidden({ - statusCode: randomInteger(403), - body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); - }); -}); + test('should be truthy when body filled, empty headers', () => { + expect( + isForbidden({ + statusCode: 403, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); -describe('notFound', () => { - test('should return 404 when empty args', () => { - expect(notFound()).toEqual({ - statusCode: 404, - headers: {}, - body: null, + test('should be truthy when body empty, filled headers', () => { + expect( + isForbidden({ + statusCode: 403, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 404 when empty body but headers filled', () => { - expect(notFound(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 404, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when fully filled', () => { + expect( + isForbidden({ + statusCode: 403, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 404 when has obect body, no headers', () => { - expect(notFound({ status: 'success' })).toEqual({ - statusCode: 404, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isForbidden({})).toEqual(false); }); - }); - test('should return 404 when has string body, no headers', () => { - expect(notFound('{"status":"success"}')).toEqual({ - statusCode: 404, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isForbidden({ + statusCode: randomInteger(403), + }) + ).toEqual(false); }); - }); - test('should return 404 when has obect body & headers', () => { - expect( - notFound( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 404, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isForbidden({ + statusCode: randomInteger(403), + body: '{"status":"success"}', + }) + ).toEqual(false); }); - }); - test('should return 404 when has string body & headers', () => { - expect( - notFound('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 404, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isForbidden({ + statusCode: randomInteger(403), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); -}); -describe('isNotFound', () => { - test('should be truthy when empty except code', () => { - expect( - isNotFound({ - statusCode: 404, - }) - ).toEqual(true); + test('should be falsy when wrong code + fully filled', () => { + expect( + isForbidden({ + statusCode: randomInteger(403), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNotFound({ + describe('notFound', () => { + test('should return 404 when empty args', () => { + expect(notFound()).toEqual({ statusCode: 404, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNotFound({ + test('should return 404 when empty body but headers filled', () => { + expect(notFound(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 404, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNotFound({ + test('should return 404 when has obect body, no headers', () => { + expect(notFound({ status: 'success' })).toEqual({ statusCode: 404, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNotFound({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNotFound({ - statusCode: randomInteger(404), - }) - ).toEqual(false); - }); + test('should return 404 when has string body, no headers', () => { + expect(notFound('{"status":"success"}')).toEqual({ + statusCode: 404, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNotFound({ - statusCode: randomInteger(404), + test('should return 404 when has obect body & headers', () => { + expect( + notFound( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 404, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNotFound({ - statusCode: randomInteger(404), + test('should return 404 when has string body & headers', () => { + expect( + notFound('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 404, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isNotFound({ - statusCode: randomInteger(404), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('methodNotAllowed', () => { - test('should return 405 when empty args', () => { - expect(methodNotAllowed()).toEqual({ - statusCode: 405, - headers: {}, - body: null, + describe('isNotFound', () => { + test('should be truthy when empty except code', () => { + expect( + isNotFound({ + statusCode: 404, + }) + ).toEqual(true); }); - }); - test('should return 405 when empty body but headers filled', () => { - expect( - methodNotAllowed(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 405, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isNotFound({ + statusCode: 404, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 405 when has obect body, no headers', () => { - expect(methodNotAllowed({ status: 'success' })).toEqual({ - statusCode: 405, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNotFound({ + statusCode: 404, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 405 when has string body, no headers', () => { - expect(methodNotAllowed('{"status":"success"}')).toEqual({ - statusCode: 405, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isNotFound({ + statusCode: 404, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 405 when has obect body & headers', () => { - expect( - methodNotAllowed( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 405, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isNotFound({})).toEqual(false); }); - }); - test('should return 405 when has string body & headers', () => { - expect( - methodNotAllowed('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 405, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isNotFound({ + statusCode: randomInteger(404), + }) + ).toEqual(false); }); - }); -}); -describe('isMethodNotAllowed', () => { - test('should be truthy when empty except code', () => { - expect( - isMethodNotAllowed({ - statusCode: 405, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNotFound({ + statusCode: randomInteger(404), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNotFound({ + statusCode: randomInteger(404), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNotFound({ + statusCode: randomInteger(404), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isMethodNotAllowed({ + describe('methodNotAllowed', () => { + test('should return 405 when empty args', () => { + expect(methodNotAllowed()).toEqual({ statusCode: 405, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isMethodNotAllowed({ + test('should return 405 when empty body but headers filled', () => { + expect( + methodNotAllowed(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 405, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isMethodNotAllowed({ + test('should return 405 when has obect body, no headers', () => { + expect(methodNotAllowed({ status: 'success' })).toEqual({ statusCode: 405, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isMethodNotAllowed({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isMethodNotAllowed({ - statusCode: randomInteger(405), - }) - ).toEqual(false); - }); + test('should return 405 when has string body, no headers', () => { + expect(methodNotAllowed('{"status":"success"}')).toEqual({ + statusCode: 405, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isMethodNotAllowed({ - statusCode: randomInteger(405), + test('should return 405 when has obect body & headers', () => { + expect( + methodNotAllowed( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 405, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isMethodNotAllowed({ - statusCode: randomInteger(405), + test('should return 405 when has string body & headers', () => { + expect( + methodNotAllowed('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 405, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isMethodNotAllowed({ - statusCode: randomInteger(405), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('notAcceptable', () => { - test('should return 406 when empty args', () => { - expect(notAcceptable()).toEqual({ - statusCode: 406, - headers: {}, - body: null, + describe('isMethodNotAllowed', () => { + test('should be truthy when empty except code', () => { + expect( + isMethodNotAllowed({ + statusCode: 405, + }) + ).toEqual(true); }); - }); - test('should return 406 when empty body but headers filled', () => { - expect( - notAcceptable(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 406, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isMethodNotAllowed({ + statusCode: 405, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 406 when has obect body, no headers', () => { - expect(notAcceptable({ status: 'success' })).toEqual({ - statusCode: 406, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isMethodNotAllowed({ + statusCode: 405, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 406 when has string body, no headers', () => { - expect(notAcceptable('{"status":"success"}')).toEqual({ - statusCode: 406, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isMethodNotAllowed({ + statusCode: 405, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 406 when has obect body & headers', () => { - expect( - notAcceptable( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 406, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isMethodNotAllowed({})).toEqual(false); }); - }); - test('should return 406 when has string body & headers', () => { - expect( - notAcceptable('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 406, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isMethodNotAllowed({ + statusCode: randomInteger(405), + }) + ).toEqual(false); }); - }); -}); -describe('isNotAcceptable', () => { - test('should be truthy when empty except code', () => { - expect( - isNotAcceptable({ - statusCode: 406, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isMethodNotAllowed({ + statusCode: randomInteger(405), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isMethodNotAllowed({ + statusCode: randomInteger(405), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isMethodNotAllowed({ + statusCode: randomInteger(405), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNotAcceptable({ + describe('notAcceptable', () => { + test('should return 406 when empty args', () => { + expect(notAcceptable()).toEqual({ statusCode: 406, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNotAcceptable({ + test('should return 406 when empty body but headers filled', () => { + expect( + notAcceptable(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 406, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNotAcceptable({ + test('should return 406 when has obect body, no headers', () => { + expect(notAcceptable({ status: 'success' })).toEqual({ statusCode: 406, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNotAcceptable({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNotAcceptable({ - statusCode: randomInteger(406), - }) - ).toEqual(false); - }); + test('should return 406 when has string body, no headers', () => { + expect(notAcceptable('{"status":"success"}')).toEqual({ + statusCode: 406, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNotAcceptable({ - statusCode: randomInteger(406), + test('should return 406 when has obect body & headers', () => { + expect( + notAcceptable( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 406, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNotAcceptable({ - statusCode: randomInteger(406), + test('should return 406 when has string body & headers', () => { + expect( + notAcceptable('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 406, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isNotAcceptable({ - statusCode: randomInteger(406), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('proxyAuthenticationRequired', () => { - test('should return 407 when empty args', () => { - expect(proxyAuthenticationRequired()).toEqual({ - statusCode: 407, - headers: {}, - body: null, + describe('isNotAcceptable', () => { + test('should be truthy when empty except code', () => { + expect( + isNotAcceptable({ + statusCode: 406, + }) + ).toEqual(true); }); - }); - test('should return 407 when empty body but headers filled', () => { - expect( - proxyAuthenticationRequired(undefined, { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 407, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isNotAcceptable({ + statusCode: 406, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 407 when has obect body, no headers', () => { - expect(proxyAuthenticationRequired({ status: 'success' })).toEqual({ - statusCode: 407, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNotAcceptable({ + statusCode: 406, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 407 when has string body, no headers', () => { - expect(proxyAuthenticationRequired('{"status":"success"}')).toEqual({ - statusCode: 407, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isNotAcceptable({ + statusCode: 406, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 407 when has obect body & headers', () => { - expect( - proxyAuthenticationRequired( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 407, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isNotAcceptable({})).toEqual(false); }); - }); - test('should return 407 when has string body & headers', () => { - expect( - proxyAuthenticationRequired('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 407, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isNotAcceptable({ + statusCode: randomInteger(406), + }) + ).toEqual(false); }); - }); -}); -describe('isProxyAuthenticationRequired', () => { - test('should be truthy when empty except code', () => { - expect( - isProxyAuthenticationRequired({ - statusCode: 407, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNotAcceptable({ + statusCode: randomInteger(406), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNotAcceptable({ + statusCode: randomInteger(406), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNotAcceptable({ + statusCode: randomInteger(406), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isProxyAuthenticationRequired({ + describe('proxyAuthenticationRequired', () => { + test('should return 407 when empty args', () => { + expect(proxyAuthenticationRequired()).toEqual({ statusCode: 407, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isProxyAuthenticationRequired({ + test('should return 407 when empty body but headers filled', () => { + expect( + proxyAuthenticationRequired(undefined, { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 407, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isProxyAuthenticationRequired({ + test('should return 407 when has obect body, no headers', () => { + expect(proxyAuthenticationRequired({ status: 'success' })).toEqual({ statusCode: 407, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isProxyAuthenticationRequired({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isProxyAuthenticationRequired({ - statusCode: randomInteger(407), - }) - ).toEqual(false); - }); + test('should return 407 when has string body, no headers', () => { + expect(proxyAuthenticationRequired('{"status":"success"}')).toEqual({ + statusCode: 407, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isProxyAuthenticationRequired({ - statusCode: randomInteger(407), + test('should return 407 when has obect body & headers', () => { + expect( + proxyAuthenticationRequired( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 407, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isProxyAuthenticationRequired({ - statusCode: randomInteger(407), + test('should return 407 when has string body & headers', () => { + expect( + proxyAuthenticationRequired('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 407, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isProxyAuthenticationRequired({ - statusCode: randomInteger(407), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('requestTimeOut', () => { - test('should return 408 when empty args', () => { - expect(requestTimeOut()).toEqual({ - statusCode: 408, - headers: {}, - body: null, + describe('isProxyAuthenticationRequired', () => { + test('should be truthy when empty except code', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: 407, + }) + ).toEqual(true); }); - }); - test('should return 408 when empty body but headers filled', () => { - expect( - requestTimeOut(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 408, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: 407, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 408 when has obect body, no headers', () => { - expect(requestTimeOut({ status: 'success' })).toEqual({ - statusCode: 408, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: 407, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 408 when has string body, no headers', () => { - expect(requestTimeOut('{"status":"success"}')).toEqual({ - statusCode: 408, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: 407, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 408 when has obect body & headers', () => { - expect( - requestTimeOut( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 408, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isProxyAuthenticationRequired({})).toEqual(false); }); - }); - test('should return 408 when has string body & headers', () => { - expect( - requestTimeOut('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 408, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: randomInteger(407), + }) + ).toEqual(false); }); - }); -}); -describe('isRequestTimeOut', () => { - test('should be truthy when empty except code', () => { - expect( - isRequestTimeOut({ - statusCode: 408, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: randomInteger(407), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: randomInteger(407), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isProxyAuthenticationRequired({ + statusCode: randomInteger(407), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isRequestTimeOut({ + describe('requestTimeOut', () => { + test('should return 408 when empty args', () => { + expect(requestTimeOut()).toEqual({ statusCode: 408, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isRequestTimeOut({ + test('should return 408 when empty body but headers filled', () => { + expect( + requestTimeOut(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 408, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isRequestTimeOut({ + test('should return 408 when has obect body, no headers', () => { + expect(requestTimeOut({ status: 'success' })).toEqual({ statusCode: 408, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isRequestTimeOut({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isRequestTimeOut({ - statusCode: randomInteger(408), - }) - ).toEqual(false); - }); + test('should return 408 when has string body, no headers', () => { + expect(requestTimeOut('{"status":"success"}')).toEqual({ + statusCode: 408, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isRequestTimeOut({ - statusCode: randomInteger(408), + test('should return 408 when has obect body & headers', () => { + expect( + requestTimeOut( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 408, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isRequestTimeOut({ - statusCode: randomInteger(408), + test('should return 408 when has string body & headers', () => { + expect( + requestTimeOut('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 408, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isRequestTimeOut({ - statusCode: randomInteger(408), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('conflict', () => { - test('should return 409 when empty args', () => { - expect(conflict()).toEqual({ - statusCode: 409, - headers: {}, - body: null, + describe('isRequestTimeOut', () => { + test('should be truthy when empty except code', () => { + expect( + isRequestTimeOut({ + statusCode: 408, + }) + ).toEqual(true); }); - }); - test('should return 409 when empty body but headers filled', () => { - expect(conflict(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 409, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isRequestTimeOut({ + statusCode: 408, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 409 when has obect body, no headers', () => { - expect(conflict({ status: 'success' })).toEqual({ - statusCode: 409, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isRequestTimeOut({ + statusCode: 408, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 409 when has string body, no headers', () => { - expect(conflict('{"status":"success"}')).toEqual({ - statusCode: 409, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isRequestTimeOut({ + statusCode: 408, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 409 when has obect body & headers', () => { - expect( - conflict( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 409, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isRequestTimeOut({})).toEqual(false); }); - }); - test('should return 409 when has string body & headers', () => { - expect( - conflict('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 409, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isRequestTimeOut({ + statusCode: randomInteger(408), + }) + ).toEqual(false); }); - }); -}); -describe('isConflict', () => { - test('should be truthy when empty except code', () => { - expect( - isConflict({ - statusCode: 409, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isRequestTimeOut({ + statusCode: randomInteger(408), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isRequestTimeOut({ + statusCode: randomInteger(408), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isRequestTimeOut({ + statusCode: randomInteger(408), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isConflict({ + describe('conflict', () => { + test('should return 409 when empty args', () => { + expect(conflict()).toEqual({ statusCode: 409, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isConflict({ + test('should return 409 when empty body but headers filled', () => { + expect(conflict(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 409, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isConflict({ + test('should return 409 when has obect body, no headers', () => { + expect(conflict({ status: 'success' })).toEqual({ statusCode: 409, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isConflict({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isConflict({ - statusCode: randomInteger(409), - }) - ).toEqual(false); - }); + test('should return 409 when has string body, no headers', () => { + expect(conflict('{"status":"success"}')).toEqual({ + statusCode: 409, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isConflict({ - statusCode: randomInteger(409), + test('should return 409 when has obect body & headers', () => { + expect( + conflict( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 409, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isConflict({ - statusCode: randomInteger(409), + test('should return 409 when has string body & headers', () => { + expect( + conflict('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 409, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isConflict({ - statusCode: randomInteger(409), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('gone', () => { - test('should return 410 when empty args', () => { - expect(gone()).toEqual({ - statusCode: 410, - headers: {}, - body: null, + describe('isConflict', () => { + test('should be truthy when empty except code', () => { + expect( + isConflict({ + statusCode: 409, + }) + ).toEqual(true); }); - }); - test('should return 410 when empty body but headers filled', () => { - expect(gone(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 410, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isConflict({ + statusCode: 409, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 410 when has obect body, no headers', () => { - expect(gone({ status: 'success' })).toEqual({ - statusCode: 410, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isConflict({ + statusCode: 409, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 410 when has string body, no headers', () => { - expect(gone('{"status":"success"}')).toEqual({ - statusCode: 410, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isConflict({ + statusCode: 409, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 410 when has obect body & headers', () => { - expect( - gone( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 410, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isConflict({})).toEqual(false); }); - }); - test('should return 410 when has string body & headers', () => { - expect( - gone('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 410, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isConflict({ + statusCode: randomInteger(409), + }) + ).toEqual(false); }); - }); -}); -describe('isGone', () => { - test('should be truthy when empty except code', () => { - expect( - isGone({ - statusCode: 410, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isConflict({ + statusCode: randomInteger(409), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isConflict({ + statusCode: randomInteger(409), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isConflict({ + statusCode: randomInteger(409), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isGone({ + describe('gone', () => { + test('should return 410 when empty args', () => { + expect(gone()).toEqual({ statusCode: 410, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isGone({ + test('should return 410 when empty body but headers filled', () => { + expect(gone(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 410, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isGone({ + test('should return 410 when has obect body, no headers', () => { + expect(gone({ status: 'success' })).toEqual({ statusCode: 410, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isGone({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isGone({ - statusCode: randomInteger(410), - }) - ).toEqual(false); - }); + test('should return 410 when has string body, no headers', () => { + expect(gone('{"status":"success"}')).toEqual({ + statusCode: 410, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isGone({ - statusCode: randomInteger(410), + test('should return 410 when has obect body & headers', () => { + expect( + gone( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 410, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isGone({ - statusCode: randomInteger(410), + test('should return 410 when has string body & headers', () => { + expect( + gone('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 410, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isGone({ - statusCode: randomInteger(410), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('lengthRequired', () => { - test('should return 411 when empty args', () => { - expect(lengthRequired()).toEqual({ - statusCode: 411, - headers: {}, - body: null, + describe('isGone', () => { + test('should be truthy when empty except code', () => { + expect( + isGone({ + statusCode: 410, + }) + ).toEqual(true); }); - }); - test('should return 411 when empty body but headers filled', () => { - expect( - lengthRequired(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 411, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isGone({ + statusCode: 410, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 411 when has obect body, no headers', () => { - expect(lengthRequired({ status: 'success' })).toEqual({ - statusCode: 411, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isGone({ + statusCode: 410, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 411 when has string body, no headers', () => { - expect(lengthRequired('{"status":"success"}')).toEqual({ - statusCode: 411, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isGone({ + statusCode: 410, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 411 when has obect body & headers', () => { - expect( - lengthRequired( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 411, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isGone({})).toEqual(false); }); - }); - test('should return 411 when has string body & headers', () => { - expect( - lengthRequired('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 411, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isGone({ + statusCode: randomInteger(410), + }) + ).toEqual(false); }); - }); -}); -describe('isLengthRequired', () => { - test('should be truthy when empty except code', () => { - expect( - isLengthRequired({ - statusCode: 411, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isGone({ + statusCode: randomInteger(410), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isGone({ + statusCode: randomInteger(410), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isGone({ + statusCode: randomInteger(410), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isLengthRequired({ + describe('lengthRequired', () => { + test('should return 411 when empty args', () => { + expect(lengthRequired()).toEqual({ statusCode: 411, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isLengthRequired({ + test('should return 411 when empty body but headers filled', () => { + expect( + lengthRequired(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 411, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isLengthRequired({ + test('should return 411 when has obect body, no headers', () => { + expect(lengthRequired({ status: 'success' })).toEqual({ statusCode: 411, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isLengthRequired({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isLengthRequired({ - statusCode: randomInteger(411), - }) - ).toEqual(false); - }); + test('should return 411 when has string body, no headers', () => { + expect(lengthRequired('{"status":"success"}')).toEqual({ + statusCode: 411, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isLengthRequired({ - statusCode: randomInteger(411), + test('should return 411 when has obect body & headers', () => { + expect( + lengthRequired( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 411, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isLengthRequired({ - statusCode: randomInteger(411), + test('should return 411 when has string body & headers', () => { + expect( + lengthRequired('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 411, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isLengthRequired({ - statusCode: randomInteger(411), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('preconditionFailed', () => { - test('should return 412 when empty args', () => { - expect(preconditionFailed()).toEqual({ - statusCode: 412, - headers: {}, - body: null, + describe('isLengthRequired', () => { + test('should be truthy when empty except code', () => { + expect( + isLengthRequired({ + statusCode: 411, + }) + ).toEqual(true); }); - }); - test('should return 412 when empty body but headers filled', () => { - expect( - preconditionFailed(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 412, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isLengthRequired({ + statusCode: 411, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 412 when has obect body, no headers', () => { - expect(preconditionFailed({ status: 'success' })).toEqual({ - statusCode: 412, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isLengthRequired({ + statusCode: 411, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 412 when has string body, no headers', () => { - expect(preconditionFailed('{"status":"success"}')).toEqual({ - statusCode: 412, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isLengthRequired({ + statusCode: 411, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 412 when has obect body & headers', () => { - expect( - preconditionFailed( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 412, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isLengthRequired({})).toEqual(false); }); - }); - test('should return 412 when has string body & headers', () => { - expect( - preconditionFailed('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 412, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isLengthRequired({ + statusCode: randomInteger(411), + }) + ).toEqual(false); }); - }); -}); -describe('isPreconditionFailed', () => { - test('should be truthy when empty except code', () => { - expect( - isPreconditionFailed({ - statusCode: 412, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isLengthRequired({ + statusCode: randomInteger(411), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isLengthRequired({ + statusCode: randomInteger(411), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isLengthRequired({ + statusCode: randomInteger(411), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isPreconditionFailed({ + describe('preconditionFailed', () => { + test('should return 412 when empty args', () => { + expect(preconditionFailed()).toEqual({ statusCode: 412, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isPreconditionFailed({ + test('should return 412 when empty body but headers filled', () => { + expect( + preconditionFailed(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 412, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isPreconditionFailed({ + test('should return 412 when has obect body, no headers', () => { + expect(preconditionFailed({ status: 'success' })).toEqual({ statusCode: 412, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isPreconditionFailed({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isPreconditionFailed({ - statusCode: randomInteger(412), - }) - ).toEqual(false); - }); + test('should return 412 when has string body, no headers', () => { + expect(preconditionFailed('{"status":"success"}')).toEqual({ + statusCode: 412, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isPreconditionFailed({ - statusCode: randomInteger(412), + test('should return 412 when has obect body & headers', () => { + expect( + preconditionFailed( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 412, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isPreconditionFailed({ - statusCode: randomInteger(412), + test('should return 412 when has string body & headers', () => { + expect( + preconditionFailed('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 412, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isPreconditionFailed({ - statusCode: randomInteger(412), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('requestEntityTooLarge', () => { - test('should return 413 when empty args', () => { - expect(requestEntityTooLarge()).toEqual({ - statusCode: 413, - headers: {}, - body: null, + describe('isPreconditionFailed', () => { + test('should be truthy when empty except code', () => { + expect( + isPreconditionFailed({ + statusCode: 412, + }) + ).toEqual(true); }); - }); - test('should return 413 when empty body but headers filled', () => { - expect( - requestEntityTooLarge(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 413, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isPreconditionFailed({ + statusCode: 412, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 413 when has obect body, no headers', () => { - expect(requestEntityTooLarge({ status: 'success' })).toEqual({ - statusCode: 413, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isPreconditionFailed({ + statusCode: 412, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 413 when has string body, no headers', () => { - expect(requestEntityTooLarge('{"status":"success"}')).toEqual({ - statusCode: 413, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isPreconditionFailed({ + statusCode: 412, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 413 when has obect body & headers', () => { - expect( - requestEntityTooLarge( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 413, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isPreconditionFailed({})).toEqual(false); }); - }); - test('should return 413 when has string body & headers', () => { - expect( - requestEntityTooLarge('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 413, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isPreconditionFailed({ + statusCode: randomInteger(412), + }) + ).toEqual(false); }); - }); -}); -describe('isRequestEntityTooLarge', () => { - test('should be truthy when empty except code', () => { - expect( - isRequestEntityTooLarge({ - statusCode: 413, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isPreconditionFailed({ + statusCode: randomInteger(412), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isPreconditionFailed({ + statusCode: randomInteger(412), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isPreconditionFailed({ + statusCode: randomInteger(412), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isRequestEntityTooLarge({ + describe('requestEntityTooLarge', () => { + test('should return 413 when empty args', () => { + expect(requestEntityTooLarge()).toEqual({ statusCode: 413, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isRequestEntityTooLarge({ + test('should return 413 when empty body but headers filled', () => { + expect( + requestEntityTooLarge(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 413, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isRequestEntityTooLarge({ + test('should return 413 when has obect body, no headers', () => { + expect(requestEntityTooLarge({ status: 'success' })).toEqual({ statusCode: 413, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isRequestEntityTooLarge({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isRequestEntityTooLarge({ - statusCode: randomInteger(413), - }) - ).toEqual(false); - }); + test('should return 413 when has string body, no headers', () => { + expect(requestEntityTooLarge('{"status":"success"}')).toEqual({ + statusCode: 413, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isRequestEntityTooLarge({ - statusCode: randomInteger(413), + test('should return 413 when has obect body & headers', () => { + expect( + requestEntityTooLarge( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 413, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isRequestEntityTooLarge({ - statusCode: randomInteger(413), + test('should return 413 when has string body & headers', () => { + expect( + requestEntityTooLarge('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 413, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isRequestEntityTooLarge({ - statusCode: randomInteger(413), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('requestUriTooLarge', () => { - test('should return 414 when empty args', () => { - expect(requestUriTooLarge()).toEqual({ - statusCode: 414, - headers: {}, - body: null, + describe('isRequestEntityTooLarge', () => { + test('should be truthy when empty except code', () => { + expect( + isRequestEntityTooLarge({ + statusCode: 413, + }) + ).toEqual(true); }); - }); - test('should return 414 when empty body but headers filled', () => { - expect( - requestUriTooLarge(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 414, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isRequestEntityTooLarge({ + statusCode: 413, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 414 when has obect body, no headers', () => { - expect(requestUriTooLarge({ status: 'success' })).toEqual({ - statusCode: 414, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isRequestEntityTooLarge({ + statusCode: 413, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 414 when has string body, no headers', () => { - expect(requestUriTooLarge('{"status":"success"}')).toEqual({ - statusCode: 414, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isRequestEntityTooLarge({ + statusCode: 413, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 414 when has obect body & headers', () => { - expect( - requestUriTooLarge( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 414, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isRequestEntityTooLarge({})).toEqual(false); }); - }); - test('should return 414 when has string body & headers', () => { - expect( - requestUriTooLarge('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 414, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isRequestEntityTooLarge({ + statusCode: randomInteger(413), + }) + ).toEqual(false); }); - }); -}); -describe('isRequestUriTooLarge', () => { - test('should be truthy when empty except code', () => { - expect( - isRequestUriTooLarge({ - statusCode: 414, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isRequestEntityTooLarge({ + statusCode: randomInteger(413), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isRequestEntityTooLarge({ + statusCode: randomInteger(413), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isRequestEntityTooLarge({ + statusCode: randomInteger(413), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isRequestUriTooLarge({ + describe('requestUriTooLarge', () => { + test('should return 414 when empty args', () => { + expect(requestUriTooLarge()).toEqual({ statusCode: 414, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isRequestUriTooLarge({ + test('should return 414 when empty body but headers filled', () => { + expect( + requestUriTooLarge(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 414, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isRequestUriTooLarge({ + test('should return 414 when has obect body, no headers', () => { + expect(requestUriTooLarge({ status: 'success' })).toEqual({ statusCode: 414, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isRequestUriTooLarge({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isRequestUriTooLarge({ - statusCode: randomInteger(414), - }) - ).toEqual(false); - }); + test('should return 414 when has string body, no headers', () => { + expect(requestUriTooLarge('{"status":"success"}')).toEqual({ + statusCode: 414, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isRequestUriTooLarge({ - statusCode: randomInteger(414), + test('should return 414 when has obect body & headers', () => { + expect( + requestUriTooLarge( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 414, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isRequestUriTooLarge({ - statusCode: randomInteger(414), + test('should return 414 when has string body & headers', () => { + expect( + requestUriTooLarge('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 414, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isRequestUriTooLarge({ - statusCode: randomInteger(414), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('unsupportedMediaType', () => { - test('should return 415 when empty args', () => { - expect(unsupportedMediaType()).toEqual({ - statusCode: 415, - headers: {}, - body: null, + describe('isRequestUriTooLarge', () => { + test('should be truthy when empty except code', () => { + expect( + isRequestUriTooLarge({ + statusCode: 414, + }) + ).toEqual(true); }); - }); - test('should return 415 when empty body but headers filled', () => { - expect( - unsupportedMediaType(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 415, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isRequestUriTooLarge({ + statusCode: 414, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 415 when has obect body, no headers', () => { - expect(unsupportedMediaType({ status: 'success' })).toEqual({ - statusCode: 415, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isRequestUriTooLarge({ + statusCode: 414, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 415 when has string body, no headers', () => { - expect(unsupportedMediaType('{"status":"success"}')).toEqual({ - statusCode: 415, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isRequestUriTooLarge({ + statusCode: 414, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 415 when has obect body & headers', () => { - expect( - unsupportedMediaType( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 415, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isRequestUriTooLarge({})).toEqual(false); }); - }); - test('should return 415 when has string body & headers', () => { - expect( - unsupportedMediaType('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 415, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isRequestUriTooLarge({ + statusCode: randomInteger(414), + }) + ).toEqual(false); }); - }); -}); -describe('isUnsupportedMediaType', () => { - test('should be truthy when empty except code', () => { - expect( - isUnsupportedMediaType({ - statusCode: 415, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isRequestUriTooLarge({ + statusCode: randomInteger(414), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isRequestUriTooLarge({ + statusCode: randomInteger(414), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isRequestUriTooLarge({ + statusCode: randomInteger(414), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isUnsupportedMediaType({ + describe('unsupportedMediaType', () => { + test('should return 415 when empty args', () => { + expect(unsupportedMediaType()).toEqual({ statusCode: 415, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isUnsupportedMediaType({ + test('should return 415 when empty body but headers filled', () => { + expect( + unsupportedMediaType(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 415, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isUnsupportedMediaType({ + test('should return 415 when has obect body, no headers', () => { + expect(unsupportedMediaType({ status: 'success' })).toEqual({ statusCode: 415, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isUnsupportedMediaType({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isUnsupportedMediaType({ - statusCode: randomInteger(415), - }) - ).toEqual(false); - }); + test('should return 415 when has string body, no headers', () => { + expect(unsupportedMediaType('{"status":"success"}')).toEqual({ + statusCode: 415, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isUnsupportedMediaType({ - statusCode: randomInteger(415), + test('should return 415 when has obect body & headers', () => { + expect( + unsupportedMediaType( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 415, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isUnsupportedMediaType({ - statusCode: randomInteger(415), + test('should return 415 when has string body & headers', () => { + expect( + unsupportedMediaType('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 415, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isUnsupportedMediaType({ - statusCode: randomInteger(415), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('requestedRangeNotSatisfiable', () => { - test('should return 416 when empty args', () => { - expect(requestedRangeNotSatisfiable()).toEqual({ - statusCode: 416, - headers: {}, - body: null, + describe('isUnsupportedMediaType', () => { + test('should be truthy when empty except code', () => { + expect( + isUnsupportedMediaType({ + statusCode: 415, + }) + ).toEqual(true); }); - }); - test('should return 416 when empty body but headers filled', () => { - expect( - requestedRangeNotSatisfiable(undefined, { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 416, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isUnsupportedMediaType({ + statusCode: 415, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 416 when has obect body, no headers', () => { - expect(requestedRangeNotSatisfiable({ status: 'success' })).toEqual({ - statusCode: 416, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isUnsupportedMediaType({ + statusCode: 415, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 416 when has string body, no headers', () => { - expect(requestedRangeNotSatisfiable('{"status":"success"}')).toEqual({ - statusCode: 416, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isUnsupportedMediaType({ + statusCode: 415, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 416 when has obect body & headers', () => { - expect( - requestedRangeNotSatisfiable( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 416, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isUnsupportedMediaType({})).toEqual(false); }); - }); - test('should return 416 when has string body & headers', () => { - expect( - requestedRangeNotSatisfiable('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 416, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isUnsupportedMediaType({ + statusCode: randomInteger(415), + }) + ).toEqual(false); }); - }); -}); -describe('isRequestedRangeNotSatisfiable', () => { - test('should be truthy when empty except code', () => { - expect( - isRequestedRangeNotSatisfiable({ - statusCode: 416, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isUnsupportedMediaType({ + statusCode: randomInteger(415), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isUnsupportedMediaType({ + statusCode: randomInteger(415), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isUnsupportedMediaType({ + statusCode: randomInteger(415), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isRequestedRangeNotSatisfiable({ + describe('requestedRangeNotSatisfiable', () => { + test('should return 416 when empty args', () => { + expect(requestedRangeNotSatisfiable()).toEqual({ statusCode: 416, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isRequestedRangeNotSatisfiable({ + test('should return 416 when empty body but headers filled', () => { + expect( + requestedRangeNotSatisfiable(undefined, { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 416, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isRequestedRangeNotSatisfiable({ + test('should return 416 when has obect body, no headers', () => { + expect(requestedRangeNotSatisfiable({ status: 'success' })).toEqual({ statusCode: 416, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isRequestedRangeNotSatisfiable({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isRequestedRangeNotSatisfiable({ - statusCode: randomInteger(416), - }) - ).toEqual(false); - }); + test('should return 416 when has string body, no headers', () => { + expect(requestedRangeNotSatisfiable('{"status":"success"}')).toEqual({ + statusCode: 416, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isRequestedRangeNotSatisfiable({ - statusCode: randomInteger(416), + test('should return 416 when has obect body & headers', () => { + expect( + requestedRangeNotSatisfiable( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 416, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isRequestedRangeNotSatisfiable({ - statusCode: randomInteger(416), + test('should return 416 when has string body & headers', () => { + expect( + requestedRangeNotSatisfiable('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 416, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isRequestedRangeNotSatisfiable({ - statusCode: randomInteger(416), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('expectationFailed', () => { - test('should return 417 when empty args', () => { - expect(expectationFailed()).toEqual({ - statusCode: 417, - headers: {}, - body: null, + describe('isRequestedRangeNotSatisfiable', () => { + test('should be truthy when empty except code', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: 416, + }) + ).toEqual(true); }); - }); - test('should return 417 when empty body but headers filled', () => { - expect( - expectationFailed(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 417, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: 416, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 417 when has obect body, no headers', () => { - expect(expectationFailed({ status: 'success' })).toEqual({ - statusCode: 417, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: 416, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 417 when has string body, no headers', () => { - expect(expectationFailed('{"status":"success"}')).toEqual({ - statusCode: 417, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: 416, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 417 when has obect body & headers', () => { - expect( - expectationFailed( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 417, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isRequestedRangeNotSatisfiable({})).toEqual(false); }); - }); - test('should return 417 when has string body & headers', () => { - expect( - expectationFailed('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 417, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: randomInteger(416), + }) + ).toEqual(false); }); - }); -}); -describe('isExpectationFailed', () => { - test('should be truthy when empty except code', () => { - expect( - isExpectationFailed({ - statusCode: 417, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: randomInteger(416), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: randomInteger(416), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isRequestedRangeNotSatisfiable({ + statusCode: randomInteger(416), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isExpectationFailed({ + describe('expectationFailed', () => { + test('should return 417 when empty args', () => { + expect(expectationFailed()).toEqual({ statusCode: 417, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isExpectationFailed({ + test('should return 417 when empty body but headers filled', () => { + expect( + expectationFailed(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 417, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isExpectationFailed({ + test('should return 417 when has obect body, no headers', () => { + expect(expectationFailed({ status: 'success' })).toEqual({ statusCode: 417, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isExpectationFailed({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isExpectationFailed({ - statusCode: randomInteger(417), - }) - ).toEqual(false); - }); + test('should return 417 when has string body, no headers', () => { + expect(expectationFailed('{"status":"success"}')).toEqual({ + statusCode: 417, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isExpectationFailed({ - statusCode: randomInteger(417), + test('should return 417 when has obect body & headers', () => { + expect( + expectationFailed( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 417, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isExpectationFailed({ - statusCode: randomInteger(417), + test('should return 417 when has string body & headers', () => { + expect( + expectationFailed('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 417, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isExpectationFailed({ - statusCode: randomInteger(417), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('imATeapot', () => { - test('should return 418 when empty args', () => { - expect(imATeapot()).toEqual({ - statusCode: 418, - headers: {}, - body: null, + describe('isExpectationFailed', () => { + test('should be truthy when empty except code', () => { + expect( + isExpectationFailed({ + statusCode: 417, + }) + ).toEqual(true); }); - }); - test('should return 418 when empty body but headers filled', () => { - expect(imATeapot(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 418, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isExpectationFailed({ + statusCode: 417, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 418 when has obect body, no headers', () => { - expect(imATeapot({ status: 'success' })).toEqual({ - statusCode: 418, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isExpectationFailed({ + statusCode: 417, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 418 when has string body, no headers', () => { - expect(imATeapot('{"status":"success"}')).toEqual({ - statusCode: 418, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isExpectationFailed({ + statusCode: 417, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 418 when has obect body & headers', () => { - expect( - imATeapot( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 418, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isExpectationFailed({})).toEqual(false); }); - }); - test('should return 418 when has string body & headers', () => { - expect( - imATeapot('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 418, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isExpectationFailed({ + statusCode: randomInteger(417), + }) + ).toEqual(false); }); - }); -}); -describe('isImATeapot', () => { - test('should be truthy when empty except code', () => { - expect( - isImATeapot({ - statusCode: 418, - }) - ).toEqual(true); - }); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isExpectationFailed({ + statusCode: randomInteger(417), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); - test('should be truthy when body filled, empty headers', () => { - expect( - isImATeapot({ - statusCode: 418, - body: '{"status":"success"}', - }) - ).toEqual(true); + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isExpectationFailed({ + statusCode: randomInteger(417), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isExpectationFailed({ + statusCode: randomInteger(417), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body empty, filled headers', () => { - expect( - isImATeapot({ + describe('imATeapot', () => { + test('should return 418 when empty args', () => { + expect(imATeapot()).toEqual({ statusCode: 418, - headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); + + test('should return 418 when empty body but headers filled', () => { + expect(imATeapot(undefined, { ContentType: 'application/json' })).toEqual( + { + statusCode: 418, + headers: { ContentType: 'application/json' }, + body: null, + } + ); + }); - test('should be truthy when fully filled', () => { - expect( - isImATeapot({ + test('should return 418 when has obect body, no headers', () => { + expect(imATeapot({ status: 'success' })).toEqual({ statusCode: 418, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isImATeapot({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isImATeapot({ - statusCode: randomInteger(418), - }) - ).toEqual(false); - }); + test('should return 418 when has string body, no headers', () => { + expect(imATeapot('{"status":"success"}')).toEqual({ + statusCode: 418, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isImATeapot({ - statusCode: randomInteger(418), + test('should return 418 when has obect body & headers', () => { + expect( + imATeapot( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 418, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isImATeapot({ - statusCode: randomInteger(418), + test('should return 418 when has string body & headers', () => { + expect( + imATeapot('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 418, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isImATeapot({ - statusCode: randomInteger(418), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('unprocessableEntity', () => { - test('should return 422 when empty args', () => { - expect(unprocessableEntity()).toEqual({ - statusCode: 422, - headers: {}, - body: null, + describe('isImATeapot', () => { + test('should be truthy when empty except code', () => { + expect( + isImATeapot({ + statusCode: 418, + }) + ).toEqual(true); }); - }); - test('should return 422 when empty body but headers filled', () => { - expect( - unprocessableEntity(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 422, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isImATeapot({ + statusCode: 418, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 422 when has obect body, no headers', () => { - expect(unprocessableEntity({ status: 'success' })).toEqual({ - statusCode: 422, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isImATeapot({ + statusCode: 418, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 422 when has string body, no headers', () => { - expect(unprocessableEntity('{"status":"success"}')).toEqual({ - statusCode: 422, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isImATeapot({ + statusCode: 418, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 422 when has obect body & headers', () => { - expect( - unprocessableEntity( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 422, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isImATeapot({})).toEqual(false); }); - }); - test('should return 422 when has string body & headers', () => { - expect( - unprocessableEntity('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 422, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isImATeapot({ + statusCode: randomInteger(418), + }) + ).toEqual(false); }); - }); -}); -describe('isUnprocessableEntity', () => { - test('should be truthy when empty except code', () => { - expect( - isUnprocessableEntity({ - statusCode: 422, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isImATeapot({ + statusCode: randomInteger(418), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isImATeapot({ + statusCode: randomInteger(418), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isImATeapot({ + statusCode: randomInteger(418), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isUnprocessableEntity({ + describe('unprocessableEntity', () => { + test('should return 422 when empty args', () => { + expect(unprocessableEntity()).toEqual({ statusCode: 422, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isUnprocessableEntity({ + test('should return 422 when empty body but headers filled', () => { + expect( + unprocessableEntity(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 422, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isUnprocessableEntity({ + test('should return 422 when has obect body, no headers', () => { + expect(unprocessableEntity({ status: 'success' })).toEqual({ statusCode: 422, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isUnprocessableEntity({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isUnprocessableEntity({ - statusCode: randomInteger(422), - }) - ).toEqual(false); - }); + test('should return 422 when has string body, no headers', () => { + expect(unprocessableEntity('{"status":"success"}')).toEqual({ + statusCode: 422, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isUnprocessableEntity({ - statusCode: randomInteger(422), + test('should return 422 when has obect body & headers', () => { + expect( + unprocessableEntity( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 422, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isUnprocessableEntity({ - statusCode: randomInteger(422), + test('should return 422 when has string body & headers', () => { + expect( + unprocessableEntity('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 422, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isUnprocessableEntity({ - statusCode: randomInteger(422), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('locked', () => { - test('should return 423 when empty args', () => { - expect(locked()).toEqual({ - statusCode: 423, - headers: {}, - body: null, + describe('isUnprocessableEntity', () => { + test('should be truthy when empty except code', () => { + expect( + isUnprocessableEntity({ + statusCode: 422, + }) + ).toEqual(true); }); - }); - test('should return 423 when empty body but headers filled', () => { - expect(locked(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 423, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isUnprocessableEntity({ + statusCode: 422, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 423 when has obect body, no headers', () => { - expect(locked({ status: 'success' })).toEqual({ - statusCode: 423, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isUnprocessableEntity({ + statusCode: 422, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 423 when has string body, no headers', () => { - expect(locked('{"status":"success"}')).toEqual({ - statusCode: 423, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isUnprocessableEntity({ + statusCode: 422, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 423 when has obect body & headers', () => { - expect( - locked( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 423, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isUnprocessableEntity({})).toEqual(false); }); - }); - test('should return 423 when has string body & headers', () => { - expect( - locked('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 423, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isUnprocessableEntity({ + statusCode: randomInteger(422), + }) + ).toEqual(false); }); - }); -}); -describe('isLocked', () => { - test('should be truthy when empty except code', () => { - expect( - isLocked({ - statusCode: 423, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isUnprocessableEntity({ + statusCode: randomInteger(422), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isUnprocessableEntity({ + statusCode: randomInteger(422), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isUnprocessableEntity({ + statusCode: randomInteger(422), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isLocked({ + describe('locked', () => { + test('should return 423 when empty args', () => { + expect(locked()).toEqual({ statusCode: 423, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isLocked({ + test('should return 423 when empty body but headers filled', () => { + expect(locked(undefined, { ContentType: 'application/json' })).toEqual({ statusCode: 423, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isLocked({ + test('should return 423 when has obect body, no headers', () => { + expect(locked({ status: 'success' })).toEqual({ statusCode: 423, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isLocked({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isLocked({ - statusCode: randomInteger(423), - }) - ).toEqual(false); - }); + test('should return 423 when has string body, no headers', () => { + expect(locked('{"status":"success"}')).toEqual({ + statusCode: 423, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isLocked({ - statusCode: randomInteger(423), + test('should return 423 when has obect body & headers', () => { + expect( + locked( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 423, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isLocked({ - statusCode: randomInteger(423), + test('should return 423 when has string body & headers', () => { + expect( + locked('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 423, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isLocked({ - statusCode: randomInteger(423), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('failedDependency', () => { - test('should return 424 when empty args', () => { - expect(failedDependency()).toEqual({ - statusCode: 424, - headers: {}, - body: null, + describe('isLocked', () => { + test('should be truthy when empty except code', () => { + expect( + isLocked({ + statusCode: 423, + }) + ).toEqual(true); }); - }); - test('should return 424 when empty body but headers filled', () => { - expect( - failedDependency(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 424, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isLocked({ + statusCode: 423, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 424 when has obect body, no headers', () => { - expect(failedDependency({ status: 'success' })).toEqual({ - statusCode: 424, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isLocked({ + statusCode: 423, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 424 when has string body, no headers', () => { - expect(failedDependency('{"status":"success"}')).toEqual({ - statusCode: 424, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isLocked({ + statusCode: 423, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 424 when has obect body & headers', () => { - expect( - failedDependency( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 424, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isLocked({})).toEqual(false); }); - }); - test('should return 424 when has string body & headers', () => { - expect( - failedDependency('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 424, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isLocked({ + statusCode: randomInteger(423), + }) + ).toEqual(false); }); - }); -}); -describe('isFailedDependency', () => { - test('should be truthy when empty except code', () => { - expect( - isFailedDependency({ - statusCode: 424, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isLocked({ + statusCode: randomInteger(423), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isLocked({ + statusCode: randomInteger(423), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isLocked({ + statusCode: randomInteger(423), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isFailedDependency({ + describe('failedDependency', () => { + test('should return 424 when empty args', () => { + expect(failedDependency()).toEqual({ statusCode: 424, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isFailedDependency({ + test('should return 424 when empty body but headers filled', () => { + expect( + failedDependency(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 424, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isFailedDependency({ + test('should return 424 when has obect body, no headers', () => { + expect(failedDependency({ status: 'success' })).toEqual({ statusCode: 424, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isFailedDependency({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isFailedDependency({ - statusCode: randomInteger(424), - }) - ).toEqual(false); - }); + test('should return 424 when has string body, no headers', () => { + expect(failedDependency('{"status":"success"}')).toEqual({ + statusCode: 424, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isFailedDependency({ - statusCode: randomInteger(424), + test('should return 424 when has obect body & headers', () => { + expect( + failedDependency( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 424, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isFailedDependency({ - statusCode: randomInteger(424), + test('should return 424 when has string body & headers', () => { + expect( + failedDependency('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 424, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isFailedDependency({ - statusCode: randomInteger(424), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('unorderedCollection', () => { - test('should return 425 when empty args', () => { - expect(unorderedCollection()).toEqual({ - statusCode: 425, - headers: {}, - body: null, + describe('isFailedDependency', () => { + test('should be truthy when empty except code', () => { + expect( + isFailedDependency({ + statusCode: 424, + }) + ).toEqual(true); }); - }); - test('should return 425 when empty body but headers filled', () => { - expect( - unorderedCollection(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 425, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isFailedDependency({ + statusCode: 424, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 425 when has obect body, no headers', () => { - expect(unorderedCollection({ status: 'success' })).toEqual({ - statusCode: 425, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isFailedDependency({ + statusCode: 424, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 425 when has string body, no headers', () => { - expect(unorderedCollection('{"status":"success"}')).toEqual({ - statusCode: 425, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isFailedDependency({ + statusCode: 424, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 425 when has obect body & headers', () => { - expect( - unorderedCollection( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 425, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isFailedDependency({})).toEqual(false); }); - }); - test('should return 425 when has string body & headers', () => { - expect( - unorderedCollection('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 425, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isFailedDependency({ + statusCode: randomInteger(424), + }) + ).toEqual(false); }); - }); -}); -describe('isUnorderedCollection', () => { - test('should be truthy when empty except code', () => { - expect( - isUnorderedCollection({ - statusCode: 425, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isFailedDependency({ + statusCode: randomInteger(424), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isFailedDependency({ + statusCode: randomInteger(424), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isFailedDependency({ + statusCode: randomInteger(424), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isUnorderedCollection({ + describe('unorderedCollection', () => { + test('should return 425 when empty args', () => { + expect(unorderedCollection()).toEqual({ statusCode: 425, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isUnorderedCollection({ + test('should return 425 when empty body but headers filled', () => { + expect( + unorderedCollection(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 425, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isUnorderedCollection({ + test('should return 425 when has obect body, no headers', () => { + expect(unorderedCollection({ status: 'success' })).toEqual({ statusCode: 425, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isUnorderedCollection({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isUnorderedCollection({ - statusCode: randomInteger(425), - }) - ).toEqual(false); - }); + test('should return 425 when has string body, no headers', () => { + expect(unorderedCollection('{"status":"success"}')).toEqual({ + statusCode: 425, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isUnorderedCollection({ - statusCode: randomInteger(425), + test('should return 425 when has obect body & headers', () => { + expect( + unorderedCollection( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 425, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isUnorderedCollection({ - statusCode: randomInteger(425), + test('should return 425 when has string body & headers', () => { + expect( + unorderedCollection('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 425, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isUnorderedCollection({ - statusCode: randomInteger(425), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('upgradeRequired', () => { - test('should return 426 when empty args', () => { - expect(upgradeRequired()).toEqual({ - statusCode: 426, - headers: {}, - body: null, + describe('isUnorderedCollection', () => { + test('should be truthy when empty except code', () => { + expect( + isUnorderedCollection({ + statusCode: 425, + }) + ).toEqual(true); }); - }); - test('should return 426 when empty body but headers filled', () => { - expect( - upgradeRequired(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 426, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isUnorderedCollection({ + statusCode: 425, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 426 when has obect body, no headers', () => { - expect(upgradeRequired({ status: 'success' })).toEqual({ - statusCode: 426, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isUnorderedCollection({ + statusCode: 425, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 426 when has string body, no headers', () => { - expect(upgradeRequired('{"status":"success"}')).toEqual({ - statusCode: 426, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isUnorderedCollection({ + statusCode: 425, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 426 when has obect body & headers', () => { - expect( - upgradeRequired( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 426, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isUnorderedCollection({})).toEqual(false); }); - }); - test('should return 426 when has string body & headers', () => { - expect( - upgradeRequired('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 426, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isUnorderedCollection({ + statusCode: randomInteger(425), + }) + ).toEqual(false); }); - }); -}); -describe('isUpgradeRequired', () => { - test('should be truthy when empty except code', () => { - expect( - isUpgradeRequired({ - statusCode: 426, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isUnorderedCollection({ + statusCode: randomInteger(425), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isUnorderedCollection({ + statusCode: randomInteger(425), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isUnorderedCollection({ + statusCode: randomInteger(425), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isUpgradeRequired({ + describe('upgradeRequired', () => { + test('should return 426 when empty args', () => { + expect(upgradeRequired()).toEqual({ statusCode: 426, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isUpgradeRequired({ + test('should return 426 when empty body but headers filled', () => { + expect( + upgradeRequired(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 426, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isUpgradeRequired({ + test('should return 426 when has obect body, no headers', () => { + expect(upgradeRequired({ status: 'success' })).toEqual({ statusCode: 426, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isUpgradeRequired({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isUpgradeRequired({ - statusCode: randomInteger(426), - }) - ).toEqual(false); - }); + test('should return 426 when has string body, no headers', () => { + expect(upgradeRequired('{"status":"success"}')).toEqual({ + statusCode: 426, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isUpgradeRequired({ - statusCode: randomInteger(426), + test('should return 426 when has obect body & headers', () => { + expect( + upgradeRequired( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 426, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isUpgradeRequired({ - statusCode: randomInteger(426), + test('should return 426 when has string body & headers', () => { + expect( + upgradeRequired('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 426, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isUpgradeRequired({ - statusCode: randomInteger(426), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('preconditionRequired', () => { - test('should return 428 when empty args', () => { - expect(preconditionRequired()).toEqual({ - statusCode: 428, - headers: {}, - body: null, + describe('isUpgradeRequired', () => { + test('should be truthy when empty except code', () => { + expect( + isUpgradeRequired({ + statusCode: 426, + }) + ).toEqual(true); }); - }); - test('should return 428 when empty body but headers filled', () => { - expect( - preconditionRequired(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 428, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isUpgradeRequired({ + statusCode: 426, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 428 when has obect body, no headers', () => { - expect(preconditionRequired({ status: 'success' })).toEqual({ - statusCode: 428, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isUpgradeRequired({ + statusCode: 426, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 428 when has string body, no headers', () => { - expect(preconditionRequired('{"status":"success"}')).toEqual({ - statusCode: 428, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isUpgradeRequired({ + statusCode: 426, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 428 when has obect body & headers', () => { - expect( - preconditionRequired( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 428, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isUpgradeRequired({})).toEqual(false); }); - }); - test('should return 428 when has string body & headers', () => { - expect( - preconditionRequired('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 428, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isUpgradeRequired({ + statusCode: randomInteger(426), + }) + ).toEqual(false); }); - }); -}); -describe('isPreconditionRequired', () => { - test('should be truthy when empty except code', () => { - expect( - isPreconditionRequired({ - statusCode: 428, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isUpgradeRequired({ + statusCode: randomInteger(426), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isUpgradeRequired({ + statusCode: randomInteger(426), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isUpgradeRequired({ + statusCode: randomInteger(426), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isPreconditionRequired({ + describe('preconditionRequired', () => { + test('should return 428 when empty args', () => { + expect(preconditionRequired()).toEqual({ statusCode: 428, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isPreconditionRequired({ + test('should return 428 when empty body but headers filled', () => { + expect( + preconditionRequired(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 428, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isPreconditionRequired({ + test('should return 428 when has obect body, no headers', () => { + expect(preconditionRequired({ status: 'success' })).toEqual({ statusCode: 428, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isPreconditionRequired({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isPreconditionRequired({ - statusCode: randomInteger(428), - }) - ).toEqual(false); - }); + test('should return 428 when has string body, no headers', () => { + expect(preconditionRequired('{"status":"success"}')).toEqual({ + statusCode: 428, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isPreconditionRequired({ - statusCode: randomInteger(428), + test('should return 428 when has obect body & headers', () => { + expect( + preconditionRequired( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 428, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isPreconditionRequired({ - statusCode: randomInteger(428), + test('should return 428 when has string body & headers', () => { + expect( + preconditionRequired('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 428, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isPreconditionRequired({ - statusCode: randomInteger(428), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('tooManyRequests', () => { - test('should return 429 when empty args', () => { - expect(tooManyRequests()).toEqual({ - statusCode: 429, - headers: {}, - body: null, + describe('isPreconditionRequired', () => { + test('should be truthy when empty except code', () => { + expect( + isPreconditionRequired({ + statusCode: 428, + }) + ).toEqual(true); }); - }); - test('should return 429 when empty body but headers filled', () => { - expect( - tooManyRequests(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 429, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isPreconditionRequired({ + statusCode: 428, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 429 when has obect body, no headers', () => { - expect(tooManyRequests({ status: 'success' })).toEqual({ - statusCode: 429, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isPreconditionRequired({ + statusCode: 428, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 429 when has string body, no headers', () => { - expect(tooManyRequests('{"status":"success"}')).toEqual({ - statusCode: 429, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isPreconditionRequired({ + statusCode: 428, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 429 when has obect body & headers', () => { - expect( - tooManyRequests( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 429, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isPreconditionRequired({})).toEqual(false); }); - }); - test('should return 429 when has string body & headers', () => { - expect( - tooManyRequests('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 429, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isPreconditionRequired({ + statusCode: randomInteger(428), + }) + ).toEqual(false); }); - }); -}); -describe('isTooManyRequests', () => { - test('should be truthy when empty except code', () => { - expect( - isTooManyRequests({ - statusCode: 429, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isPreconditionRequired({ + statusCode: randomInteger(428), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isPreconditionRequired({ + statusCode: randomInteger(428), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isPreconditionRequired({ + statusCode: randomInteger(428), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isTooManyRequests({ + describe('tooManyRequests', () => { + test('should return 429 when empty args', () => { + expect(tooManyRequests()).toEqual({ statusCode: 429, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isTooManyRequests({ + test('should return 429 when empty body but headers filled', () => { + expect( + tooManyRequests(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 429, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isTooManyRequests({ + test('should return 429 when has obect body, no headers', () => { + expect(tooManyRequests({ status: 'success' })).toEqual({ statusCode: 429, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isTooManyRequests({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isTooManyRequests({ - statusCode: randomInteger(429), - }) - ).toEqual(false); - }); + test('should return 429 when has string body, no headers', () => { + expect(tooManyRequests('{"status":"success"}')).toEqual({ + statusCode: 429, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isTooManyRequests({ - statusCode: randomInteger(429), + test('should return 429 when has obect body & headers', () => { + expect( + tooManyRequests( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 429, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isTooManyRequests({ - statusCode: randomInteger(429), + test('should return 429 when has string body & headers', () => { + expect( + tooManyRequests('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 429, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isTooManyRequests({ - statusCode: randomInteger(429), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('requestHeaderFieldsTooLarge', () => { - test('should return 431 when empty args', () => { - expect(requestHeaderFieldsTooLarge()).toEqual({ - statusCode: 431, - headers: {}, - body: null, + describe('isTooManyRequests', () => { + test('should be truthy when empty except code', () => { + expect( + isTooManyRequests({ + statusCode: 429, + }) + ).toEqual(true); }); - }); - test('should return 431 when empty body but headers filled', () => { - expect( - requestHeaderFieldsTooLarge(undefined, { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 431, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isTooManyRequests({ + statusCode: 429, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 431 when has obect body, no headers', () => { - expect(requestHeaderFieldsTooLarge({ status: 'success' })).toEqual({ - statusCode: 431, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isTooManyRequests({ + statusCode: 429, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 431 when has string body, no headers', () => { - expect(requestHeaderFieldsTooLarge('{"status":"success"}')).toEqual({ - statusCode: 431, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isTooManyRequests({ + statusCode: 429, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 431 when has obect body & headers', () => { - expect( - requestHeaderFieldsTooLarge( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 431, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isTooManyRequests({})).toEqual(false); }); - }); - test('should return 431 when has string body & headers', () => { - expect( - requestHeaderFieldsTooLarge('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 431, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isTooManyRequests({ + statusCode: randomInteger(429), + }) + ).toEqual(false); }); - }); -}); -describe('isRequestHeaderFieldsTooLarge', () => { - test('should be truthy when empty except code', () => { - expect( - isRequestHeaderFieldsTooLarge({ - statusCode: 431, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isTooManyRequests({ + statusCode: randomInteger(429), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isTooManyRequests({ + statusCode: randomInteger(429), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isTooManyRequests({ + statusCode: randomInteger(429), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isRequestHeaderFieldsTooLarge({ + describe('requestHeaderFieldsTooLarge', () => { + test('should return 431 when empty args', () => { + expect(requestHeaderFieldsTooLarge()).toEqual({ statusCode: 431, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isRequestHeaderFieldsTooLarge({ + test('should return 431 when empty body but headers filled', () => { + expect( + requestHeaderFieldsTooLarge(undefined, { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 431, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isRequestHeaderFieldsTooLarge({ + test('should return 431 when has obect body, no headers', () => { + expect(requestHeaderFieldsTooLarge({ status: 'success' })).toEqual({ statusCode: 431, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isRequestHeaderFieldsTooLarge({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isRequestHeaderFieldsTooLarge({ - statusCode: randomInteger(431), - }) - ).toEqual(false); - }); + test('should return 431 when has string body, no headers', () => { + expect(requestHeaderFieldsTooLarge('{"status":"success"}')).toEqual({ + statusCode: 431, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isRequestHeaderFieldsTooLarge({ - statusCode: randomInteger(431), + test('should return 431 when has obect body & headers', () => { + expect( + requestHeaderFieldsTooLarge( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 431, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isRequestHeaderFieldsTooLarge({ - statusCode: randomInteger(431), + test('should return 431 when has string body & headers', () => { + expect( + requestHeaderFieldsTooLarge('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 431, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isRequestHeaderFieldsTooLarge({ - statusCode: randomInteger(431), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('internalServerError', () => { - test('should return 500 when empty args', () => { - expect(internalServerError()).toEqual({ - statusCode: 500, - headers: {}, - body: null, + describe('isRequestHeaderFieldsTooLarge', () => { + test('should be truthy when empty except code', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: 431, + }) + ).toEqual(true); }); - }); - test('should return 500 when empty body but headers filled', () => { - expect( - internalServerError(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 500, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: 431, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 500 when has obect body, no headers', () => { - expect(internalServerError({ status: 'success' })).toEqual({ - statusCode: 500, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: 431, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 500 when has string body, no headers', () => { - expect(internalServerError('{"status":"success"}')).toEqual({ - statusCode: 500, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: 431, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 500 when has obect body & headers', () => { - expect( - internalServerError( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 500, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isRequestHeaderFieldsTooLarge({})).toEqual(false); }); - }); - test('should return 500 when has string body & headers', () => { - expect( - internalServerError('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 500, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: randomInteger(431), + }) + ).toEqual(false); }); - }); -}); -describe('isInternalServerError', () => { - test('should be truthy when empty except code', () => { - expect( - isInternalServerError({ - statusCode: 500, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: randomInteger(431), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: randomInteger(431), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isRequestHeaderFieldsTooLarge({ + statusCode: randomInteger(431), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isInternalServerError({ + describe('internalServerError', () => { + test('should return 500 when empty args', () => { + expect(internalServerError()).toEqual({ statusCode: 500, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isInternalServerError({ + test('should return 500 when empty body but headers filled', () => { + expect( + internalServerError(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 500, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isInternalServerError({ + test('should return 500 when has obect body, no headers', () => { + expect(internalServerError({ status: 'success' })).toEqual({ statusCode: 500, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isInternalServerError({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isInternalServerError({ - statusCode: randomInteger(500), - }) - ).toEqual(false); - }); + test('should return 500 when has string body, no headers', () => { + expect(internalServerError('{"status":"success"}')).toEqual({ + statusCode: 500, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isInternalServerError({ - statusCode: randomInteger(500), + test('should return 500 when has obect body & headers', () => { + expect( + internalServerError( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 500, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isInternalServerError({ - statusCode: randomInteger(500), + test('should return 500 when has string body & headers', () => { + expect( + internalServerError('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 500, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isInternalServerError({ - statusCode: randomInteger(500), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('notImplemented', () => { - test('should return 501 when empty args', () => { - expect(notImplemented()).toEqual({ - statusCode: 501, - headers: {}, - body: null, + describe('isInternalServerError', () => { + test('should be truthy when empty except code', () => { + expect( + isInternalServerError({ + statusCode: 500, + }) + ).toEqual(true); }); - }); - test('should return 501 when empty body but headers filled', () => { - expect( - notImplemented(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 501, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isInternalServerError({ + statusCode: 500, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 501 when has obect body, no headers', () => { - expect(notImplemented({ status: 'success' })).toEqual({ - statusCode: 501, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isInternalServerError({ + statusCode: 500, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 501 when has string body, no headers', () => { - expect(notImplemented('{"status":"success"}')).toEqual({ - statusCode: 501, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isInternalServerError({ + statusCode: 500, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 501 when has obect body & headers', () => { - expect( - notImplemented( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 501, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isInternalServerError({})).toEqual(false); }); - }); - test('should return 501 when has string body & headers', () => { - expect( - notImplemented('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 501, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isInternalServerError({ + statusCode: randomInteger(500), + }) + ).toEqual(false); }); - }); -}); -describe('isNotImplemented', () => { - test('should be truthy when empty except code', () => { - expect( - isNotImplemented({ - statusCode: 501, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isInternalServerError({ + statusCode: randomInteger(500), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isInternalServerError({ + statusCode: randomInteger(500), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isInternalServerError({ + statusCode: randomInteger(500), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNotImplemented({ + describe('notImplemented', () => { + test('should return 501 when empty args', () => { + expect(notImplemented()).toEqual({ statusCode: 501, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNotImplemented({ + test('should return 501 when empty body but headers filled', () => { + expect( + notImplemented(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 501, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNotImplemented({ + test('should return 501 when has obect body, no headers', () => { + expect(notImplemented({ status: 'success' })).toEqual({ statusCode: 501, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNotImplemented({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNotImplemented({ - statusCode: randomInteger(501), - }) - ).toEqual(false); - }); + test('should return 501 when has string body, no headers', () => { + expect(notImplemented('{"status":"success"}')).toEqual({ + statusCode: 501, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNotImplemented({ - statusCode: randomInteger(501), + test('should return 501 when has obect body & headers', () => { + expect( + notImplemented( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 501, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNotImplemented({ - statusCode: randomInteger(501), + test('should return 501 when has string body & headers', () => { + expect( + notImplemented('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 501, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isNotImplemented({ - statusCode: randomInteger(501), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('badGateway', () => { - test('should return 502 when empty args', () => { - expect(badGateway()).toEqual({ - statusCode: 502, - headers: {}, - body: null, + describe('isNotImplemented', () => { + test('should be truthy when empty except code', () => { + expect( + isNotImplemented({ + statusCode: 501, + }) + ).toEqual(true); }); - }); - test('should return 502 when empty body but headers filled', () => { - expect(badGateway(undefined, { ContentType: 'application/json' })).toEqual({ - statusCode: 502, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isNotImplemented({ + statusCode: 501, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 502 when has obect body, no headers', () => { - expect(badGateway({ status: 'success' })).toEqual({ - statusCode: 502, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNotImplemented({ + statusCode: 501, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 502 when has string body, no headers', () => { - expect(badGateway('{"status":"success"}')).toEqual({ - statusCode: 502, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isNotImplemented({ + statusCode: 501, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 502 when has obect body & headers', () => { - expect( - badGateway( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 502, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isNotImplemented({})).toEqual(false); }); - }); - test('should return 502 when has string body & headers', () => { - expect( - badGateway('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 502, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isNotImplemented({ + statusCode: randomInteger(501), + }) + ).toEqual(false); }); - }); -}); -describe('isBadGateway', () => { - test('should be truthy when empty except code', () => { - expect( - isBadGateway({ - statusCode: 502, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNotImplemented({ + statusCode: randomInteger(501), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNotImplemented({ + statusCode: randomInteger(501), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNotImplemented({ + statusCode: randomInteger(501), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isBadGateway({ + describe('badGateway', () => { + test('should return 502 when empty args', () => { + expect(badGateway()).toEqual({ statusCode: 502, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isBadGateway({ + test('should return 502 when empty body but headers filled', () => { + expect( + badGateway(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 502, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isBadGateway({ + test('should return 502 when has obect body, no headers', () => { + expect(badGateway({ status: 'success' })).toEqual({ statusCode: 502, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isBadGateway({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isBadGateway({ - statusCode: randomInteger(502), - }) - ).toEqual(false); - }); + test('should return 502 when has string body, no headers', () => { + expect(badGateway('{"status":"success"}')).toEqual({ + statusCode: 502, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isBadGateway({ - statusCode: randomInteger(502), + test('should return 502 when has obect body & headers', () => { + expect( + badGateway( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 502, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isBadGateway({ - statusCode: randomInteger(502), + test('should return 502 when has string body & headers', () => { + expect( + badGateway('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 502, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isBadGateway({ - statusCode: randomInteger(502), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('serviceUnavailable', () => { - test('should return 503 when empty args', () => { - expect(serviceUnavailable()).toEqual({ - statusCode: 503, - headers: {}, - body: null, + describe('isBadGateway', () => { + test('should be truthy when empty except code', () => { + expect( + isBadGateway({ + statusCode: 502, + }) + ).toEqual(true); }); - }); - test('should return 503 when empty body but headers filled', () => { - expect( - serviceUnavailable(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 503, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isBadGateway({ + statusCode: 502, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 503 when has obect body, no headers', () => { - expect(serviceUnavailable({ status: 'success' })).toEqual({ - statusCode: 503, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isBadGateway({ + statusCode: 502, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 503 when has string body, no headers', () => { - expect(serviceUnavailable('{"status":"success"}')).toEqual({ - statusCode: 503, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isBadGateway({ + statusCode: 502, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 503 when has obect body & headers', () => { - expect( - serviceUnavailable( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 503, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isBadGateway({})).toEqual(false); }); - }); - test('should return 503 when has string body & headers', () => { - expect( - serviceUnavailable('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 503, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isBadGateway({ + statusCode: randomInteger(502), + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isBadGateway({ + statusCode: randomInteger(502), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isBadGateway({ + statusCode: randomInteger(502), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isBadGateway({ + statusCode: randomInteger(502), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); }); }); -}); -describe('isServiceUnavailable', () => { - test('should be truthy when empty except code', () => { - expect( - isServiceUnavailable({ + describe('serviceUnavailable', () => { + test('should return 503 when empty args', () => { + expect(serviceUnavailable()).toEqual({ statusCode: 503, - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body filled, empty headers', () => { - expect( - isServiceUnavailable({ + test('should return 503 when empty body but headers filled', () => { + expect( + serviceUnavailable(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 503, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: { ContentType: 'application/json' }, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isServiceUnavailable({ + test('should return 503 when empty body but headers filled', () => { + setAutoSerialize(false); + expect( + serviceUnavailable(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 503, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isServiceUnavailable({ + test('should return 503 when has obect body, no headers', () => { + expect(serviceUnavailable({ status: 'success' })).toEqual({ statusCode: 503, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isServiceUnavailable({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isServiceUnavailable({ - statusCode: randomInteger(503), - }) - ).toEqual(false); - }); + test('should return 503 when has string body, no headers', () => { + expect(serviceUnavailable('{"status":"success"}')).toEqual({ + statusCode: 503, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isServiceUnavailable({ - statusCode: randomInteger(503), + test('should return 503 when has obect body & headers', () => { + expect( + serviceUnavailable( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 503, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isServiceUnavailable({ - statusCode: randomInteger(503), + test('should return 503 when has string body & headers', () => { + expect( + serviceUnavailable('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 503, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isServiceUnavailable({ - statusCode: randomInteger(503), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('gatewayTimeOut', () => { - test('should return 504 when empty args', () => { - expect(gatewayTimeOut()).toEqual({ - statusCode: 504, - headers: {}, - body: null, + describe('isServiceUnavailable', () => { + test('should be truthy when empty except code', () => { + expect( + isServiceUnavailable({ + statusCode: 503, + }) + ).toEqual(true); }); - }); - test('should return 504 when empty body but headers filled', () => { - expect( - gatewayTimeOut(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 504, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isServiceUnavailable({ + statusCode: 503, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 504 when has obect body, no headers', () => { - expect(gatewayTimeOut({ status: 'success' })).toEqual({ - statusCode: 504, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isServiceUnavailable({ + statusCode: 503, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 504 when has string body, no headers', () => { - expect(gatewayTimeOut('{"status":"success"}')).toEqual({ - statusCode: 504, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isServiceUnavailable({ + statusCode: 503, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 504 when has obect body & headers', () => { - expect( - gatewayTimeOut( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 504, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isServiceUnavailable({})).toEqual(false); }); - }); - test('should return 504 when has string body & headers', () => { - expect( - gatewayTimeOut('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 504, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isServiceUnavailable({ + statusCode: randomInteger(503), + }) + ).toEqual(false); }); - }); -}); -describe('isGatewayTimeOut', () => { - test('should be truthy when empty except code', () => { - expect( - isGatewayTimeOut({ - statusCode: 504, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isServiceUnavailable({ + statusCode: randomInteger(503), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isServiceUnavailable({ + statusCode: randomInteger(503), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isServiceUnavailable({ + statusCode: randomInteger(503), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isGatewayTimeOut({ + describe('gatewayTimeOut', () => { + test('should return 504 when empty args', () => { + expect(gatewayTimeOut()).toEqual({ statusCode: 504, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isGatewayTimeOut({ + test('should return 504 when empty body but headers filled', () => { + expect( + gatewayTimeOut(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 504, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isGatewayTimeOut({ + test('should return 504 when has obect body, no headers', () => { + expect(gatewayTimeOut({ status: 'success' })).toEqual({ statusCode: 504, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); + }); + }); - test('should be falsy when code empty', () => { - expect(isGatewayTimeOut({})).toEqual(false); - }); + test('should return 504 when has string body, no headers', () => { + expect(gatewayTimeOut('{"status":"success"}')).toEqual({ + statusCode: 504, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code', () => { - expect( - isGatewayTimeOut({ - statusCode: randomInteger(504), - }) - ).toEqual(false); - }); + test('should return 504 when has obect body & headers', () => { + expect( + gatewayTimeOut( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 504, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, + body: '{"status":"success"}', + }); + }); + + test('should return 504 when has obect body & headers', () => { + setAutoSerialize(false); + expect( + gatewayTimeOut( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 504, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, + body: { status: 'success' }, + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isGatewayTimeOut({ - statusCode: randomInteger(504), + test('should return 504 when has string body & headers', () => { + expect( + gatewayTimeOut('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 504, + headers: { ContentType: 'application/json' }, body: '{"status":"success"}', - }) - ).toEqual(false); + }); + }); }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isGatewayTimeOut({ - statusCode: randomInteger(504), - headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); + describe('isGatewayTimeOut', () => { + test('should be truthy when empty except code', () => { + expect( + isGatewayTimeOut({ + statusCode: 504, + }) + ).toEqual(true); + }); - test('should be falsy when wrong code + fully filled', () => { - expect( - isGatewayTimeOut({ - statusCode: randomInteger(504), - body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); - }); -}); + test('should be truthy when body filled, empty headers', () => { + expect( + isGatewayTimeOut({ + statusCode: 504, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); -describe('httpVersionNotSupported', () => { - test('should return 505 when empty args', () => { - expect(httpVersionNotSupported()).toEqual({ - statusCode: 505, - headers: {}, - body: null, + test('should be truthy when body empty, filled headers', () => { + expect( + isGatewayTimeOut({ + statusCode: 504, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 505 when empty body but headers filled', () => { - expect( - httpVersionNotSupported(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 505, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when fully filled', () => { + expect( + isGatewayTimeOut({ + statusCode: 504, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 505 when has obect body, no headers', () => { - expect(httpVersionNotSupported({ status: 'success' })).toEqual({ - statusCode: 505, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isGatewayTimeOut({})).toEqual(false); }); - }); - test('should return 505 when has string body, no headers', () => { - expect(httpVersionNotSupported('{"status":"success"}')).toEqual({ - statusCode: 505, - headers: {}, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isGatewayTimeOut({ + statusCode: randomInteger(504), + }) + ).toEqual(false); }); - }); - test('should return 505 when has obect body & headers', () => { - expect( - httpVersionNotSupported( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 505, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isGatewayTimeOut({ + statusCode: randomInteger(504), + body: '{"status":"success"}', + }) + ).toEqual(false); }); - }); - test('should return 505 when has string body & headers', () => { - expect( - httpVersionNotSupported('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 505, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isGatewayTimeOut({ + statusCode: randomInteger(504), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); }); - }); -}); -describe('isHttpVersionNotSupported', () => { - test('should be truthy when empty except code', () => { - expect( - isHttpVersionNotSupported({ - statusCode: 505, - }) - ).toEqual(true); + test('should be falsy when wrong code + fully filled', () => { + expect( + isGatewayTimeOut({ + statusCode: randomInteger(504), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isHttpVersionNotSupported({ + describe('httpVersionNotSupported', () => { + test('should return 505 when empty args', () => { + expect(httpVersionNotSupported()).toEqual({ statusCode: 505, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isHttpVersionNotSupported({ + test('should return 505 when empty body but headers filled', () => { + expect( + httpVersionNotSupported(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 505, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isHttpVersionNotSupported({ + test('should return 505 when has obect body, no headers', () => { + expect(httpVersionNotSupported({ status: 'success' })).toEqual({ statusCode: 505, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isHttpVersionNotSupported({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isHttpVersionNotSupported({ - statusCode: randomInteger(505), - }) - ).toEqual(false); - }); + test('should return 505 when has string body, no headers', () => { + expect(httpVersionNotSupported('{"status":"success"}')).toEqual({ + statusCode: 505, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isHttpVersionNotSupported({ - statusCode: randomInteger(505), + test('should return 505 when has obect body & headers', () => { + expect( + httpVersionNotSupported( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 505, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isHttpVersionNotSupported({ - statusCode: randomInteger(505), + test('should return 505 when has string body & headers', () => { + expect( + httpVersionNotSupported('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 505, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isHttpVersionNotSupported({ - statusCode: randomInteger(505), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('variantAlsoNegotiates', () => { - test('should return 506 when empty args', () => { - expect(variantAlsoNegotiates()).toEqual({ - statusCode: 506, - headers: {}, - body: null, + describe('isHttpVersionNotSupported', () => { + test('should be truthy when empty except code', () => { + expect( + isHttpVersionNotSupported({ + statusCode: 505, + }) + ).toEqual(true); }); - }); - test('should return 506 when empty body but headers filled', () => { - expect( - variantAlsoNegotiates(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 506, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isHttpVersionNotSupported({ + statusCode: 505, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 506 when has obect body, no headers', () => { - expect(variantAlsoNegotiates({ status: 'success' })).toEqual({ - statusCode: 506, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isHttpVersionNotSupported({ + statusCode: 505, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 506 when has string body, no headers', () => { - expect(variantAlsoNegotiates('{"status":"success"}')).toEqual({ - statusCode: 506, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isHttpVersionNotSupported({ + statusCode: 505, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 506 when has obect body & headers', () => { - expect( - variantAlsoNegotiates( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 506, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isHttpVersionNotSupported({})).toEqual(false); }); - }); - test('should return 506 when has string body & headers', () => { - expect( - variantAlsoNegotiates('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 506, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isHttpVersionNotSupported({ + statusCode: randomInteger(505), + }) + ).toEqual(false); }); - }); -}); -describe('isVariantAlsoNegotiates', () => { - test('should be truthy when empty except code', () => { - expect( - isVariantAlsoNegotiates({ - statusCode: 506, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isHttpVersionNotSupported({ + statusCode: randomInteger(505), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isHttpVersionNotSupported({ + statusCode: randomInteger(505), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isHttpVersionNotSupported({ + statusCode: randomInteger(505), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isVariantAlsoNegotiates({ + describe('variantAlsoNegotiates', () => { + test('should return 506 when empty args', () => { + expect(variantAlsoNegotiates()).toEqual({ statusCode: 506, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isVariantAlsoNegotiates({ + test('should return 506 when empty body but headers filled', () => { + expect( + variantAlsoNegotiates(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 506, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isVariantAlsoNegotiates({ + test('should return 506 when has obect body, no headers', () => { + expect(variantAlsoNegotiates({ status: 'success' })).toEqual({ statusCode: 506, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isVariantAlsoNegotiates({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isVariantAlsoNegotiates({ - statusCode: randomInteger(506), - }) - ).toEqual(false); - }); + test('should return 506 when has string body, no headers', () => { + expect(variantAlsoNegotiates('{"status":"success"}')).toEqual({ + statusCode: 506, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isVariantAlsoNegotiates({ - statusCode: randomInteger(506), + test('should return 506 when has obect body & headers', () => { + expect( + variantAlsoNegotiates( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 506, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isVariantAlsoNegotiates({ - statusCode: randomInteger(506), + test('should return 506 when has string body & headers', () => { + expect( + variantAlsoNegotiates('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 506, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isVariantAlsoNegotiates({ - statusCode: randomInteger(506), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('insufficientStorage', () => { - test('should return 507 when empty args', () => { - expect(insufficientStorage()).toEqual({ - statusCode: 507, - headers: {}, - body: null, + describe('isVariantAlsoNegotiates', () => { + test('should be truthy when empty except code', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: 506, + }) + ).toEqual(true); }); - }); - test('should return 507 when empty body but headers filled', () => { - expect( - insufficientStorage(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 507, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: 506, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 507 when has obect body, no headers', () => { - expect(insufficientStorage({ status: 'success' })).toEqual({ - statusCode: 507, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: 506, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 507 when has string body, no headers', () => { - expect(insufficientStorage('{"status":"success"}')).toEqual({ - statusCode: 507, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: 506, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 507 when has obect body & headers', () => { - expect( - insufficientStorage( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 507, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isVariantAlsoNegotiates({})).toEqual(false); }); - }); - test('should return 507 when has string body & headers', () => { - expect( - insufficientStorage('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 507, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: randomInteger(506), + }) + ).toEqual(false); }); - }); -}); -describe('isInsufficientStorage', () => { - test('should be truthy when empty except code', () => { - expect( - isInsufficientStorage({ - statusCode: 507, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: randomInteger(506), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: randomInteger(506), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isVariantAlsoNegotiates({ + statusCode: randomInteger(506), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isInsufficientStorage({ + describe('insufficientStorage', () => { + test('should return 507 when empty args', () => { + expect(insufficientStorage()).toEqual({ statusCode: 507, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isInsufficientStorage({ + test('should return 507 when empty body but headers filled', () => { + expect( + insufficientStorage(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 507, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isInsufficientStorage({ + test('should return 507 when has obect body, no headers', () => { + expect(insufficientStorage({ status: 'success' })).toEqual({ statusCode: 507, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isInsufficientStorage({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isInsufficientStorage({ - statusCode: randomInteger(507), - }) - ).toEqual(false); - }); + test('should return 507 when has string body, no headers', () => { + expect(insufficientStorage('{"status":"success"}')).toEqual({ + statusCode: 507, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isInsufficientStorage({ - statusCode: randomInteger(507), + test('should return 507 when has obect body & headers', () => { + expect( + insufficientStorage( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 507, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isInsufficientStorage({ - statusCode: randomInteger(507), + test('should return 507 when has string body & headers', () => { + expect( + insufficientStorage('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 507, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isInsufficientStorage({ - statusCode: randomInteger(507), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('bandwidthLimitExceeded', () => { - test('should return 509 when empty args', () => { - expect(bandwidthLimitExceeded()).toEqual({ - statusCode: 509, - headers: {}, - body: null, + describe('isInsufficientStorage', () => { + test('should be truthy when empty except code', () => { + expect( + isInsufficientStorage({ + statusCode: 507, + }) + ).toEqual(true); }); - }); - test('should return 509 when empty body but headers filled', () => { - expect( - bandwidthLimitExceeded(undefined, { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 509, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isInsufficientStorage({ + statusCode: 507, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 509 when has obect body, no headers', () => { - expect(bandwidthLimitExceeded({ status: 'success' })).toEqual({ - statusCode: 509, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isInsufficientStorage({ + statusCode: 507, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 509 when has string body, no headers', () => { - expect(bandwidthLimitExceeded('{"status":"success"}')).toEqual({ - statusCode: 509, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isInsufficientStorage({ + statusCode: 507, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 509 when has obect body & headers', () => { - expect( - bandwidthLimitExceeded( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 509, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isInsufficientStorage({})).toEqual(false); }); - }); - test('should return 509 when has string body & headers', () => { - expect( - bandwidthLimitExceeded('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 509, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isInsufficientStorage({ + statusCode: randomInteger(507), + }) + ).toEqual(false); }); - }); -}); -describe('isBandwidthLimitExceeded', () => { - test('should be truthy when empty except code', () => { - expect( - isBandwidthLimitExceeded({ - statusCode: 509, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isInsufficientStorage({ + statusCode: randomInteger(507), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isInsufficientStorage({ + statusCode: randomInteger(507), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isInsufficientStorage({ + statusCode: randomInteger(507), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isBandwidthLimitExceeded({ + describe('bandwidthLimitExceeded', () => { + test('should return 509 when empty args', () => { + expect(bandwidthLimitExceeded()).toEqual({ statusCode: 509, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isBandwidthLimitExceeded({ + test('should return 509 when empty body but headers filled', () => { + expect( + bandwidthLimitExceeded(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 509, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isBandwidthLimitExceeded({ + test('should return 509 when has obect body, no headers', () => { + expect(bandwidthLimitExceeded({ status: 'success' })).toEqual({ statusCode: 509, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isBandwidthLimitExceeded({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isBandwidthLimitExceeded({ - statusCode: randomInteger(509), - }) - ).toEqual(false); - }); + test('should return 509 when has string body, no headers', () => { + expect(bandwidthLimitExceeded('{"status":"success"}')).toEqual({ + statusCode: 509, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isBandwidthLimitExceeded({ - statusCode: randomInteger(509), + test('should return 509 when has obect body & headers', () => { + expect( + bandwidthLimitExceeded( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 509, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isBandwidthLimitExceeded({ - statusCode: randomInteger(509), + test('should return 509 when has string body & headers', () => { + expect( + bandwidthLimitExceeded('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 509, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isBandwidthLimitExceeded({ - statusCode: randomInteger(509), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('notExtended', () => { - test('should return 510 when empty args', () => { - expect(notExtended()).toEqual({ - statusCode: 510, - headers: {}, - body: null, + describe('isBandwidthLimitExceeded', () => { + test('should be truthy when empty except code', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: 509, + }) + ).toEqual(true); }); - }); - test('should return 510 when empty body but headers filled', () => { - expect(notExtended(undefined, { ContentType: 'application/json' })).toEqual( - { - statusCode: 510, - headers: { ContentType: 'application/json' }, - body: null, - } - ); - }); + test('should be truthy when body filled, empty headers', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: 509, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); - test('should return 510 when has obect body, no headers', () => { - expect(notExtended({ status: 'success' })).toEqual({ - statusCode: 510, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: 509, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 510 when has string body, no headers', () => { - expect(notExtended('{"status":"success"}')).toEqual({ - statusCode: 510, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: 509, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 510 when has obect body & headers', () => { - expect( - notExtended( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 510, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isBandwidthLimitExceeded({})).toEqual(false); }); - }); - test('should return 510 when has string body & headers', () => { - expect( - notExtended('{"status":"success"}', { ContentType: 'application/json' }) - ).toEqual({ - statusCode: 510, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: randomInteger(509), + }) + ).toEqual(false); }); - }); -}); -describe('isNotExtended', () => { - test('should be truthy when empty except code', () => { - expect( - isNotExtended({ - statusCode: 510, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: randomInteger(509), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: randomInteger(509), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isBandwidthLimitExceeded({ + statusCode: randomInteger(509), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNotExtended({ + describe('notExtended', () => { + test('should return 510 when empty args', () => { + expect(notExtended()).toEqual({ statusCode: 510, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNotExtended({ + test('should return 510 when empty body but headers filled', () => { + expect( + notExtended(undefined, { ContentType: 'application/json' }) + ).toEqual({ statusCode: 510, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNotExtended({ + test('should return 510 when has obect body, no headers', () => { + expect(notExtended({ status: 'success' })).toEqual({ statusCode: 510, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNotExtended({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNotExtended({ - statusCode: randomInteger(510), - }) - ).toEqual(false); - }); + test('should return 510 when has string body, no headers', () => { + expect(notExtended('{"status":"success"}')).toEqual({ + statusCode: 510, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNotExtended({ - statusCode: randomInteger(510), + test('should return 510 when has obect body & headers', () => { + expect( + notExtended( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 510, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNotExtended({ - statusCode: randomInteger(510), + test('should return 510 when has string body & headers', () => { + expect( + notExtended('{"status":"success"}', { ContentType: 'application/json' }) + ).toEqual({ + statusCode: 510, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); - }); - - test('should be falsy when wrong code + fully filled', () => { - expect( - isNotExtended({ - statusCode: randomInteger(510), body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + }); + }); }); -}); -describe('networkAuthenticationRequired', () => { - test('should return 511 when empty args', () => { - expect(networkAuthenticationRequired()).toEqual({ - statusCode: 511, - headers: {}, - body: null, + describe('isNotExtended', () => { + test('should be truthy when empty except code', () => { + expect( + isNotExtended({ + statusCode: 510, + }) + ).toEqual(true); }); - }); - test('should return 511 when empty body but headers filled', () => { - expect( - networkAuthenticationRequired(undefined, { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 511, - headers: { ContentType: 'application/json' }, - body: null, + test('should be truthy when body filled, empty headers', () => { + expect( + isNotExtended({ + statusCode: 510, + body: '{"status":"success"}', + }) + ).toEqual(true); }); - }); - test('should return 511 when has obect body, no headers', () => { - expect(networkAuthenticationRequired({ status: 'success' })).toEqual({ - statusCode: 511, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when body empty, filled headers', () => { + expect( + isNotExtended({ + statusCode: 510, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); }); - }); - test('should return 511 when has string body, no headers', () => { - expect(networkAuthenticationRequired('{"status":"success"}')).toEqual({ - statusCode: 511, - headers: {}, - body: '{"status":"success"}', + test('should be truthy when fully filled', () => { + expect( + isNotExtended({ + statusCode: 510, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); }); - }); - test('should return 511 when has obect body & headers', () => { - expect( - networkAuthenticationRequired( - { status: 'success' }, - { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - } - ) - ).toEqual({ - statusCode: 511, - headers: { - ContentType: 'application/json', - 'Accept-Encoding': 'gzip, deflate, br', - }, - body: '{"status":"success"}', + test('should be falsy when code empty', () => { + expect(isNotExtended({})).toEqual(false); }); - }); - test('should return 511 when has string body & headers', () => { - expect( - networkAuthenticationRequired('{"status":"success"}', { - ContentType: 'application/json', - }) - ).toEqual({ - statusCode: 511, - headers: { ContentType: 'application/json' }, - body: '{"status":"success"}', + test('should be falsy when wrong code', () => { + expect( + isNotExtended({ + statusCode: randomInteger(510), + }) + ).toEqual(false); }); - }); -}); -describe('isNetworkAuthenticationRequired', () => { - test('should be truthy when empty except code', () => { - expect( - isNetworkAuthenticationRequired({ - statusCode: 511, - }) - ).toEqual(true); + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNotExtended({ + statusCode: randomInteger(510), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNotExtended({ + statusCode: randomInteger(510), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNotExtended({ + statusCode: randomInteger(510), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); - test('should be truthy when body filled, empty headers', () => { - expect( - isNetworkAuthenticationRequired({ + describe('networkAuthenticationRequired', () => { + test('should return 511 when empty args', () => { + expect(networkAuthenticationRequired()).toEqual({ statusCode: 511, - body: '{"status":"success"}', - }) - ).toEqual(true); - }); + headers: {}, + body: null, + }); + }); - test('should be truthy when body empty, filled headers', () => { - expect( - isNetworkAuthenticationRequired({ + test('should return 511 when empty body but headers filled', () => { + expect( + networkAuthenticationRequired(undefined, { + ContentType: 'application/json', + }) + ).toEqual({ statusCode: 511, headers: { ContentType: 'application/json' }, - }) - ).toEqual(true); - }); + body: null, + }); + }); - test('should be truthy when fully filled', () => { - expect( - isNetworkAuthenticationRequired({ + test('should return 511 when has obect body, no headers', () => { + expect(networkAuthenticationRequired({ status: 'success' })).toEqual({ statusCode: 511, + headers: {}, body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(true); - }); - - test('should be falsy when code empty', () => { - expect(isNetworkAuthenticationRequired({})).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code', () => { - expect( - isNetworkAuthenticationRequired({ - statusCode: randomInteger(511), - }) - ).toEqual(false); - }); + test('should return 511 when has string body, no headers', () => { + expect(networkAuthenticationRequired('{"status":"success"}')).toEqual({ + statusCode: 511, + headers: {}, + body: '{"status":"success"}', + }); + }); - test('should be falsy when wrong code + body filled, empty headers', () => { - expect( - isNetworkAuthenticationRequired({ - statusCode: randomInteger(511), + test('should return 511 when has obect body & headers', () => { + expect( + networkAuthenticationRequired( + { status: 'success' }, + { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + } + ) + ).toEqual({ + statusCode: 511, + headers: { + ContentType: 'application/json', + 'Accept-Encoding': 'gzip, deflate, br', + }, body: '{"status":"success"}', - }) - ).toEqual(false); - }); + }); + }); - test('should be falsy when wrong code + body empty, filled headers', () => { - expect( - isNetworkAuthenticationRequired({ - statusCode: randomInteger(511), + test('should return 511 when has string body & headers', () => { + expect( + networkAuthenticationRequired('{"status":"success"}', { + ContentType: 'application/json', + }) + ).toEqual({ + statusCode: 511, headers: { ContentType: 'application/json' }, - }) - ).toEqual(false); + body: '{"status":"success"}', + }); + }); }); - test('should be falsy when wrong code + fully filled', () => { - expect( - isNetworkAuthenticationRequired({ - statusCode: randomInteger(511), - body: '{"status":"success"}', - headers: { 'Accept-Encoding': 'gzip, deflate, br' }, - }) - ).toEqual(false); + describe('isNetworkAuthenticationRequired', () => { + test('should be truthy when empty except code', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: 511, + }) + ).toEqual(true); + }); + + test('should be truthy when body filled, empty headers', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: 511, + body: '{"status":"success"}', + }) + ).toEqual(true); + }); + + test('should be truthy when body empty, filled headers', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: 511, + headers: { ContentType: 'application/json' }, + }) + ).toEqual(true); + }); + + test('should be truthy when fully filled', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: 511, + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(true); + }); + + test('should be falsy when code empty', () => { + expect(isNetworkAuthenticationRequired({})).toEqual(false); + }); + + test('should be falsy when wrong code', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: randomInteger(511), + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body filled, empty headers', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: randomInteger(511), + body: '{"status":"success"}', + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + body empty, filled headers', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: randomInteger(511), + headers: { ContentType: 'application/json' }, + }) + ).toEqual(false); + }); + + test('should be falsy when wrong code + fully filled', () => { + expect( + isNetworkAuthenticationRequired({ + statusCode: randomInteger(511), + body: '{"status":"success"}', + headers: { 'Accept-Encoding': 'gzip, deflate, br' }, + }) + ).toEqual(false); + }); }); }); diff --git a/src/index.ts b/src/index.ts index 408bd91..2533bc1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,17 @@ import { OutgoingHttpHeaders } from 'node:http'; +let autoSerialize = true; +export function setAutoSerialize(flag: boolean) { + autoSerialize = flag; +} + +export function serializeBody(body?: object): string | object | null { + return autoSerialize ? JSON.stringify(body ?? {}) : body ?? null; +} + // continue can't be used as it, it's JS reserved word export type ContinueLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 100; }; @@ -17,7 +26,7 @@ export function httpContinue( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -30,7 +39,7 @@ export function isContinue(response?: { } export type SwitchingProtocolsLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 101; }; @@ -45,7 +54,7 @@ export function switchingProtocols( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -58,7 +67,7 @@ export function isSwitchingProtocols(response?: { } export type ProcessingLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 102; }; @@ -73,7 +82,7 @@ export function processing( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -86,7 +95,7 @@ export function isProcessing(response?: { } export type OkLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 200; }; @@ -101,7 +110,7 @@ export function ok( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -114,7 +123,7 @@ export function isOk(response?: { } export type CreatedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 201; }; @@ -129,7 +138,7 @@ export function created( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -142,7 +151,7 @@ export function isCreated(response?: { } export type AcceptedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 202; }; @@ -157,7 +166,7 @@ export function accepted( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -170,7 +179,7 @@ export function isAccepted(response?: { } export type NonAuthoritativeInformationLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 203; }; @@ -185,7 +194,7 @@ export function nonAuthoritativeInformation( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -219,7 +228,7 @@ export function isNoContent(response?: { } export type ResetContentLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 205; }; @@ -234,7 +243,7 @@ export function resetContent( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -247,7 +256,7 @@ export function isResetContent(response?: { } export type PartialContentLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 206; }; @@ -262,7 +271,7 @@ export function partialContent( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -275,7 +284,7 @@ export function isPartialContent(response?: { } export type MultiStatusLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 207; }; @@ -290,7 +299,7 @@ export function multiStatus( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -303,7 +312,7 @@ export function isMultiStatus(response?: { } export type MultipleChoicesLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 300; }; @@ -318,7 +327,7 @@ export function multipleChoices( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -331,7 +340,7 @@ export function isMultipleChoices(response?: { } export type MovedPermanentlyLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 301; }; @@ -346,7 +355,7 @@ export function movedPermanently( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -359,7 +368,7 @@ export function isMovedPermanently(response?: { } export type MovedTemporarilyLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 302; }; @@ -374,7 +383,7 @@ export function movedTemporarily( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -387,7 +396,7 @@ export function isMovedTemporarily(response?: { } export type SeeOtherLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 303; }; @@ -402,7 +411,7 @@ export function seeOther( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -415,7 +424,7 @@ export function isSeeOther(response?: { } export type NotModifiedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 304; }; @@ -430,7 +439,7 @@ export function notModified( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -443,7 +452,7 @@ export function isNotModified(response?: { } export type UseProxyLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 305; }; @@ -458,7 +467,7 @@ export function useProxy( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -471,7 +480,7 @@ export function isUseProxy(response?: { } export type TemporaryRedirectLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 307; }; @@ -486,7 +495,7 @@ export function temporaryRedirect( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -499,7 +508,7 @@ export function isTemporaryRedirect(response?: { } export type BadRequestLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 400; }; @@ -514,7 +523,7 @@ export function badRequest( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -527,7 +536,7 @@ export function isBadRequest(response?: { } export type UnauthorizedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 401; }; @@ -542,7 +551,7 @@ export function unauthorized( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -555,7 +564,7 @@ export function isUnauthorized(response?: { } export type PaymentRequiredLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 402; }; @@ -570,7 +579,7 @@ export function paymentRequired( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -583,7 +592,7 @@ export function isPaymentRequired(response?: { } export type ForbiddenLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 403; }; @@ -598,7 +607,7 @@ export function forbidden( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -611,7 +620,7 @@ export function isForbidden(response?: { } export type NotFoundLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 404; }; @@ -626,7 +635,7 @@ export function notFound( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -639,7 +648,7 @@ export function isNotFound(response?: { } export type MethodNotAllowedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 405; }; @@ -654,7 +663,7 @@ export function methodNotAllowed( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -667,7 +676,7 @@ export function isMethodNotAllowed(response?: { } export type NotAcceptableLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 406; }; @@ -682,7 +691,7 @@ export function notAcceptable( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -695,7 +704,7 @@ export function isNotAcceptable(response?: { } export type ProxyAuthenticationRequiredLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 407; }; @@ -710,7 +719,7 @@ export function proxyAuthenticationRequired( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -723,7 +732,7 @@ export function isProxyAuthenticationRequired(response?: { } export type RequestTimeOutLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 408; }; @@ -738,7 +747,7 @@ export function requestTimeOut( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -751,7 +760,7 @@ export function isRequestTimeOut(response?: { } export type ConflictLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 409; }; @@ -766,7 +775,7 @@ export function conflict( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -779,7 +788,7 @@ export function isConflict(response?: { } export type GoneLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 410; }; @@ -794,7 +803,7 @@ export function gone( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -807,7 +816,7 @@ export function isGone(response?: { } export type LengthRequiredLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 411; }; @@ -822,7 +831,7 @@ export function lengthRequired( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -835,7 +844,7 @@ export function isLengthRequired(response?: { } export type PreconditionFailedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 412; }; @@ -850,7 +859,7 @@ export function preconditionFailed( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -863,7 +872,7 @@ export function isPreconditionFailed(response?: { } export type RequestEntityTooLargeLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 413; }; @@ -878,7 +887,7 @@ export function requestEntityTooLarge( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -891,7 +900,7 @@ export function isRequestEntityTooLarge(response?: { } export type RequestUriTooLargeLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 414; }; @@ -906,7 +915,7 @@ export function requestUriTooLarge( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -919,7 +928,7 @@ export function isRequestUriTooLarge(response?: { } export type UnsupportedMediaTypeLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 415; }; @@ -934,7 +943,7 @@ export function unsupportedMediaType( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -947,7 +956,7 @@ export function isUnsupportedMediaType(response?: { } export type RequestedRangeNotSatisfiableLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 416; }; @@ -962,7 +971,7 @@ export function requestedRangeNotSatisfiable( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -975,7 +984,7 @@ export function isRequestedRangeNotSatisfiable(response?: { } export type ExpectationFailedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 417; }; @@ -990,7 +999,7 @@ export function expectationFailed( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1003,7 +1012,7 @@ export function isExpectationFailed(response?: { } export type ImATeapotLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 418; }; @@ -1018,7 +1027,7 @@ export function imATeapot( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1031,7 +1040,7 @@ export function isImATeapot(response?: { } export type UnprocessableEntityLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 422; }; @@ -1046,7 +1055,7 @@ export function unprocessableEntity( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1059,7 +1068,7 @@ export function isUnprocessableEntity(response?: { } export type LockedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 423; }; @@ -1074,7 +1083,7 @@ export function locked( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1087,7 +1096,7 @@ export function isLocked(response?: { } export type FailedDependencyLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 424; }; @@ -1102,7 +1111,7 @@ export function failedDependency( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1115,7 +1124,7 @@ export function isFailedDependency(response?: { } export type UnorderedCollectionLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 425; }; @@ -1130,7 +1139,7 @@ export function unorderedCollection( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1143,7 +1152,7 @@ export function isUnorderedCollection(response?: { } export type UpgradeRequiredLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 426; }; @@ -1158,7 +1167,7 @@ export function upgradeRequired( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1171,7 +1180,7 @@ export function isUpgradeRequired(response?: { } export type PreconditionRequiredLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 428; }; @@ -1186,7 +1195,7 @@ export function preconditionRequired( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1199,7 +1208,7 @@ export function isPreconditionRequired(response?: { } export type TooManyRequestsLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 429; }; @@ -1214,7 +1223,7 @@ export function tooManyRequests( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1227,7 +1236,7 @@ export function isTooManyRequests(response?: { } export type RequestHeaderFieldsTooLargeLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 431; }; @@ -1242,7 +1251,7 @@ export function requestHeaderFieldsTooLarge( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1255,7 +1264,7 @@ export function isRequestHeaderFieldsTooLarge(response?: { } export type InternalServerErrorLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 500; }; @@ -1270,7 +1279,7 @@ export function internalServerError( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1283,7 +1292,7 @@ export function isInternalServerError(response?: { } export type NotImplementedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 501; }; @@ -1298,7 +1307,7 @@ export function notImplemented( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1311,7 +1320,7 @@ export function isNotImplemented(response?: { } export type BadGatewayLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 502; }; @@ -1326,7 +1335,7 @@ export function badGateway( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1339,7 +1348,7 @@ export function isBadGateway(response?: { } export type ServiceUnavailableLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 503; }; @@ -1354,7 +1363,7 @@ export function serviceUnavailable( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1367,7 +1376,7 @@ export function isServiceUnavailable(response?: { } export type GatewayTimeOutLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 504; }; @@ -1382,7 +1391,7 @@ export function gatewayTimeOut( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1395,7 +1404,7 @@ export function isGatewayTimeOut(response?: { } export type HttpVersionNotSupportedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 505; }; @@ -1410,7 +1419,7 @@ export function httpVersionNotSupported( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1423,7 +1432,7 @@ export function isHttpVersionNotSupported(response?: { } export type VariantAlsoNegotiatesLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 506; }; @@ -1438,7 +1447,7 @@ export function variantAlsoNegotiates( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1451,7 +1460,7 @@ export function isVariantAlsoNegotiates(response?: { } export type InsufficientStorageLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 507; }; @@ -1466,7 +1475,7 @@ export function insufficientStorage( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1479,7 +1488,7 @@ export function isInsufficientStorage(response?: { } export type BandwidthLimitExceededLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 509; }; @@ -1494,7 +1503,7 @@ export function bandwidthLimitExceeded( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1507,7 +1516,7 @@ export function isBandwidthLimitExceeded(response?: { } export type NotExtendedLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 510; }; @@ -1522,7 +1531,7 @@ export function notExtended( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; } @@ -1535,7 +1544,7 @@ export function isNotExtended(response?: { } export type NetworkAuthenticationRequiredLambdaResponse = { - body: string | null; + body: string | object | null; headers?: OutgoingHttpHeaders; statusCode: 511; }; @@ -1550,7 +1559,7 @@ export function networkAuthenticationRequired( body: result ? typeof result === 'string' ? result - : JSON.stringify(result) + : serializeBody(result) : null, }; }