From 54b0668e4a1f71e373ab771791c05ee9d295efea Mon Sep 17 00:00:00 2001 From: StevanFreeborn Date: Thu, 2 Feb 2023 22:59:07 -0600 Subject: [PATCH] fix: corrected JSDoc comments --- src/models/ApiResponse.ts | 4 ++++ src/models/OnspringClient.ts | 3 +-- tests/Field.spec.ts | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/models/ApiResponse.ts b/src/models/ApiResponse.ts index ac2f4d2..8ab9c3d 100644 --- a/src/models/ApiResponse.ts +++ b/src/models/ApiResponse.ts @@ -110,6 +110,10 @@ export class ApiResponse { ); } + /** + * @method AsFieldType - Converts the ApiResponse to an ApiResponse. + * @returns {ApiResponse} - An ApiResponse. + */ public AsFieldType(): ApiResponse { const apiResponse = this as ApiResponse; diff --git a/src/models/OnspringClient.ts b/src/models/OnspringClient.ts index bc6fa61..b72eeeb 100644 --- a/src/models/OnspringClient.ts +++ b/src/models/OnspringClient.ts @@ -111,8 +111,7 @@ export class OnspringClient { } /** - * @method getFields - Gets a paged list of fields. - * @param {PagingRequest} pagingRequest - The paging request that will be used to get the fields. + * @method getFieldById - Gets a field by its id. * @returns {Promise>} - A promise that resolves to an ApiResponse of type Field. */ public async getFieldById(fieldId: number): Promise> { diff --git a/tests/Field.spec.ts b/tests/Field.spec.ts index 9c1a628..b45c110 100644 --- a/tests/Field.spec.ts +++ b/tests/Field.spec.ts @@ -20,6 +20,18 @@ describe('Field', function () { ).to.not.throw(); }); + it('should throw an error when the type parameter is not a valid value', function () { + expect( + () => new Field(1, 1, 'Text Field', 'Invalid', 'Enabled', true, false) + ).to.throw(); + }); + + it('should throw an error when the status parameter is not a valid value', function () { + expect( + () => new Field(1, 1, 'Text Field', 'Text', 'Unabled', true, false) + ).to.throw(); + }); + it('should create a new instance of the Field class with the correct properties and values', function () { const field = new Field(1, 1, 'Text Field', 'Text', 'Enabled', true, false); @@ -38,16 +50,4 @@ describe('Field', function () { expect(field.isRequired).to.equal(true); expect(field.isUnique).to.equal(false); }); - - it('should throw an error when the type parameter is not a valid value', function () { - expect( - () => new Field(1, 1, 'Text Field', 'Invalid', 'Enabled', true, false) - ).to.throw(); - }); - - it('should throw an error when the status parameter is not a valid value', function () { - expect( - () => new Field(1, 1, 'Text Field', 'Text', 'Unabled', true, false) - ).to.throw(); - }); });