feat: implement addOrUpdateListItem method

This commit is contained in:
Stevan Freeborn
2023-02-07 11:52:46 -06:00
parent a68ea4f63e
commit 190c829dc3
8 changed files with 391 additions and 0 deletions
+26
View File
@@ -18,6 +18,7 @@ import { File } from '../src/models/File';
import fs from 'fs';
import { type AxiosResponse } from 'axios';
import path from 'path';
import { ListItemResponse } from '../src/models/ListItemResponse';
describe('ApiResponse', function () {
it('should be defined', function () {
@@ -916,4 +917,29 @@ describe('ApiResponse', function () {
expect(fileResponse.data).to.have.property('contentLength', 0);
});
});
describe('asListItemResponseType', function () {
it('should be defined', function () {
expect(ApiResponse.prototype.asListItemResponseType).to.not.be.undefined;
});
it('should be a function', function () {
expect(ApiResponse.prototype.asListItemResponseType).to.be.a('function');
});
it('should have no parameters', function () {
expect(ApiResponse.prototype.asListItemResponseType.length).to.equal(0);
});
it('should return an ApiResponse<ListItemResponse>', function () {
const apiResponse = new ApiResponse(200, 'OK', {
id: '3fa85f64-5717-4562-b3fc-2c963f66afa6',
});
const listItemResponse = apiResponse.asListItemResponseType();
expect(listItemResponse).to.be.an.instanceof(ApiResponse);
expect(listItemResponse.data).to.be.an.instanceof(ListItemResponse);
expect(listItemResponse.data).to.have.property(
'id',
'3fa85f64-5717-4562-b3fc-2c963f66afa6'
);
});
});
});