2023-01-27 11:28:45 -06:00
|
|
|
import { HttpStatusCode } from '../src/enums/HttpStatusCode';
|
|
|
|
|
import { expect } from 'chai';
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('HttpStatusCode', function () {
|
|
|
|
|
describe('OK', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.OK;
|
|
|
|
|
expect(result).to.equal(200);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('Created', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.Created;
|
|
|
|
|
expect(result).to.equal(201);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('Accepted', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.Accepted;
|
|
|
|
|
expect(result).to.equal(202);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('NoContent', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.NoContent;
|
|
|
|
|
expect(result).to.equal(204);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('BadRequest', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.BadRequest;
|
|
|
|
|
expect(result).to.equal(400);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('Unauthorized', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.Unauthorized;
|
|
|
|
|
expect(result).to.equal(401);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('Forbidden', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.Forbidden;
|
|
|
|
|
expect(result).to.equal(403);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('NotFound', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.NotFound;
|
|
|
|
|
expect(result).to.equal(404);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('MethodNotAllowed', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.MethodNotAllowed;
|
|
|
|
|
expect(result).to.equal(405);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('Conflict', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.Conflict;
|
|
|
|
|
expect(result).to.equal(409);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('InternalServerError', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.InternalServerError;
|
|
|
|
|
expect(result).to.equal(500);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('NotImplemented', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.NotImplemented;
|
|
|
|
|
expect(result).to.equal(501);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('BadGateway', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.BadGateway;
|
|
|
|
|
expect(result).to.equal(502);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('ServiceUnavailable', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.ServiceUnavailable;
|
|
|
|
|
expect(result).to.equal(503);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
|
2023-02-03 00:16:38 -06:00
|
|
|
describe('GatewayTimeout', function () {
|
|
|
|
|
it('should return the correct value', function () {
|
2023-01-27 11:28:45 -06:00
|
|
|
const result = HttpStatusCode.GatewayTimeout;
|
|
|
|
|
expect(result).to.equal(504);
|
|
|
|
|
});
|
|
|
|
|
});
|
2023-02-01 23:45:14 -06:00
|
|
|
});
|