fix: add eslint and configure it
This commit is contained in:
@@ -9,6 +9,7 @@ import { FieldType } from '../src/enums/FieldType';
|
||||
|
||||
describe('ApiResponse', function () {
|
||||
it('should be defined', function () {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
expect(ApiResponse).to.not.be.undefined;
|
||||
});
|
||||
|
||||
@@ -108,7 +109,7 @@ describe('ApiResponse', function () {
|
||||
],
|
||||
};
|
||||
|
||||
const apiResponse = new ApiResponse<any>(200, 'OK', mockResponseData);
|
||||
const apiResponse = new ApiResponse(200, 'OK', mockResponseData);
|
||||
const appsPagedResponse = apiResponse.AsGetPagedAppsResponseType();
|
||||
|
||||
expect(appsPagedResponse).to.be.instanceOf(ApiResponse);
|
||||
@@ -126,7 +127,7 @@ describe('ApiResponse', function () {
|
||||
}
|
||||
});
|
||||
|
||||
it('should return an ApiResponse<GetPagedAppsResponse> when data contains app items', function () {
|
||||
it('should return an ApiResponse<GetPagedAppsResponse> when data contains no app items', function () {
|
||||
const mockResponseData = {
|
||||
pageNumber: 0,
|
||||
pageSize: 0,
|
||||
@@ -135,7 +136,7 @@ describe('ApiResponse', function () {
|
||||
items: [],
|
||||
};
|
||||
|
||||
const apiResponse = new ApiResponse<any>(200, 'OK', mockResponseData);
|
||||
const apiResponse = new ApiResponse(200, 'OK', mockResponseData);
|
||||
const appsPagedResponse = apiResponse.AsGetPagedAppsResponseType();
|
||||
|
||||
expect(appsPagedResponse).to.be.instanceOf(ApiResponse);
|
||||
@@ -168,7 +169,7 @@ describe('ApiResponse', function () {
|
||||
name: 'Test App',
|
||||
};
|
||||
|
||||
const apiResponse = new ApiResponse<any>(200, 'OK', mockResponseData);
|
||||
const apiResponse = new ApiResponse(200, 'OK', mockResponseData);
|
||||
const appResponse = apiResponse.AsAppType();
|
||||
|
||||
expect(appResponse).to.be.instanceOf(ApiResponse);
|
||||
@@ -209,7 +210,7 @@ describe('ApiResponse', function () {
|
||||
],
|
||||
};
|
||||
|
||||
const apiResponse = new ApiResponse<any>(200, 'OK', mockResponseData);
|
||||
const apiResponse = new ApiResponse(200, 'OK', mockResponseData);
|
||||
const appCollectionResponse = apiResponse.AsAppCollectionType();
|
||||
|
||||
expect(appCollectionResponse).to.be.instanceOf(
|
||||
@@ -252,7 +253,7 @@ describe('ApiResponse', function () {
|
||||
isUnique: false,
|
||||
};
|
||||
|
||||
const apiResponse = new ApiResponse<any>(200, 'OK', mockResponseData);
|
||||
const apiResponse = new ApiResponse(200, 'OK', mockResponseData);
|
||||
const fieldResponse = apiResponse.AsFieldType();
|
||||
|
||||
expect(fieldResponse).to.be.instanceOf(ApiResponse);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApiResponseFactory } from '../src/models/ApiResponseFactory';
|
||||
import { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
||||
import { type AxiosResponse, type InternalAxiosRequestConfig } from 'axios';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('ApiResponseFactory', function () {
|
||||
|
||||
@@ -153,10 +153,6 @@ describe('ArgumentValidator', function () {
|
||||
expect(ArgumentValidator.isValidUrl('www.google.com')).to.be.false;
|
||||
});
|
||||
|
||||
it('should return false when invalid url is passed', function () {
|
||||
expect(ArgumentValidator.isValidUrl('ht://www.google')).to.be.false;
|
||||
});
|
||||
|
||||
it('should return false when url with non http or https protocol is passed', function () {
|
||||
expect(ArgumentValidator.isValidUrl('ftp://www.google.com')).to.be.false;
|
||||
});
|
||||
|
||||
@@ -1,107 +1,107 @@
|
||||
import { HttpStatusCode } from '../src/enums/HttpStatusCode';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('HttpStatusCode', () => {
|
||||
describe('OK', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('HttpStatusCode', function () {
|
||||
describe('OK', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.OK;
|
||||
expect(result).to.equal(200);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Created', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('Created', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.Created;
|
||||
expect(result).to.equal(201);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Accepted', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('Accepted', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.Accepted;
|
||||
expect(result).to.equal(202);
|
||||
});
|
||||
});
|
||||
|
||||
describe('NoContent', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('NoContent', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.NoContent;
|
||||
expect(result).to.equal(204);
|
||||
});
|
||||
});
|
||||
|
||||
describe('BadRequest', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('BadRequest', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.BadRequest;
|
||||
expect(result).to.equal(400);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Unauthorized', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('Unauthorized', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.Unauthorized;
|
||||
expect(result).to.equal(401);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Forbidden', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('Forbidden', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.Forbidden;
|
||||
expect(result).to.equal(403);
|
||||
});
|
||||
});
|
||||
|
||||
describe('NotFound', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('NotFound', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.NotFound;
|
||||
expect(result).to.equal(404);
|
||||
});
|
||||
});
|
||||
|
||||
describe('MethodNotAllowed', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('MethodNotAllowed', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.MethodNotAllowed;
|
||||
expect(result).to.equal(405);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Conflict', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('Conflict', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.Conflict;
|
||||
expect(result).to.equal(409);
|
||||
});
|
||||
});
|
||||
|
||||
describe('InternalServerError', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('InternalServerError', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.InternalServerError;
|
||||
expect(result).to.equal(500);
|
||||
});
|
||||
});
|
||||
|
||||
describe('NotImplemented', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('NotImplemented', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.NotImplemented;
|
||||
expect(result).to.equal(501);
|
||||
});
|
||||
});
|
||||
|
||||
describe('BadGateway', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('BadGateway', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.BadGateway;
|
||||
expect(result).to.equal(502);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ServiceUnavailable', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('ServiceUnavailable', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.ServiceUnavailable;
|
||||
expect(result).to.equal(503);
|
||||
});
|
||||
});
|
||||
|
||||
describe('GatewayTimeout', () => {
|
||||
it('should return the correct value', () => {
|
||||
describe('GatewayTimeout', function () {
|
||||
it('should return the correct value', function () {
|
||||
const result = HttpStatusCode.GatewayTimeout;
|
||||
expect(result).to.equal(504);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { OnspringClient } from '../src/models/OnspringClient';
|
||||
import { ApiResponse } from '../src/models/ApiResponse';
|
||||
import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios';
|
||||
import axios, {
|
||||
type AxiosResponse,
|
||||
type InternalAxiosRequestConfig,
|
||||
} from 'axios';
|
||||
import { expect } from 'chai';
|
||||
import * as sinon from 'sinon';
|
||||
import { GetPagedAppsResponse } from '../src/models/GetPagedAppsResponse';
|
||||
@@ -84,12 +87,6 @@ describe('OnspringClient', function () {
|
||||
expect(() => new OnspringClient(baseUrl, apiKey)).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not throw an error when the baseUrl is a valid url', function () {
|
||||
expect(
|
||||
() => new OnspringClient('http://api.onspring.com', apiKey)
|
||||
).to.not.throw();
|
||||
});
|
||||
|
||||
it('should not throw an error when the apiKey is a valid string', function () {
|
||||
expect(() => new OnspringClient(baseUrl, apiKey)).to.not.throw();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user