feat: add filter operator enum, add models for getting records by ids and querying records
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { FilterOperators } from '../src/enums/FilterOperators';
|
||||
import { expect } from 'chai';
|
||||
|
||||
describe('FilterOperators', function () {
|
||||
it('should be defined', function () {
|
||||
expect(FilterOperators).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should have a Equal property with value "eq"', function () {
|
||||
expect(FilterOperators).to.have.property('Equal', 'eq');
|
||||
});
|
||||
|
||||
it('should have a NotEqual property with value "ne"', function () {
|
||||
expect(FilterOperators).to.have.property('NotEqual', 'ne');
|
||||
});
|
||||
|
||||
it('should have a Contains property with value "contains"', function () {
|
||||
expect(FilterOperators).to.have.property('Contains', 'contains');
|
||||
});
|
||||
|
||||
it('should have a IsNull property with value "isnull"', function () {
|
||||
expect(FilterOperators).to.have.property('IsNull', 'isnull');
|
||||
});
|
||||
|
||||
it('should have a NotNull property with value "notnull"', function () {
|
||||
expect(FilterOperators).to.have.property('NotNull', 'notnull');
|
||||
});
|
||||
|
||||
it('should have a GreaterThan property with value "gt"', function () {
|
||||
expect(FilterOperators).to.have.property('GreaterThan', 'gt');
|
||||
});
|
||||
|
||||
it('should have a LessThan property with value "lt"', function () {
|
||||
expect(FilterOperators).to.have.property('LessThan', 'lt');
|
||||
});
|
||||
|
||||
it('should have a And property with value "and"', function () {
|
||||
expect(FilterOperators).to.have.property('And', 'and');
|
||||
});
|
||||
|
||||
it('should have a Or property with value "or"', function () {
|
||||
expect(FilterOperators).to.have.property('Or', 'or');
|
||||
});
|
||||
|
||||
it('should have a Not property with value "not"', function () {
|
||||
expect(FilterOperators).to.have.property('Not', 'not');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
import { GetRecordsRequest } from '../src/models/GetRecordsRequest';
|
||||
import { expect } from 'chai';
|
||||
import { DataFormat } from '../src/enums/DataFormat';
|
||||
|
||||
describe('GetRecordsRequest', function () {
|
||||
it('should be defined', function () {
|
||||
expect(GetRecordsRequest).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should have a constructor', function () {
|
||||
expect(GetRecordsRequest).to.have.property('constructor');
|
||||
});
|
||||
|
||||
it('should have a constructor with 2 parameters', function () {
|
||||
expect(GetRecordsRequest).to.have.lengthOf(2);
|
||||
});
|
||||
|
||||
it('should have an appId property', function () {
|
||||
expect(new GetRecordsRequest(1, [1, 2])).to.have.property('appId');
|
||||
});
|
||||
|
||||
it('should have a recordIds property', function () {
|
||||
expect(new GetRecordsRequest(1, [1, 2])).to.have.property('recordIds');
|
||||
});
|
||||
|
||||
it('should have a fieldIds property', function () {
|
||||
expect(new GetRecordsRequest(1, [1, 2])).to.have.property('fieldIds');
|
||||
});
|
||||
|
||||
it('should have a dataFormat property', function () {
|
||||
expect(new GetRecordsRequest(1, [1, 2])).to.have.property('dataFormat');
|
||||
});
|
||||
|
||||
it('should have a constructor that sets its properties correctly', function () {
|
||||
const appId = 1;
|
||||
const recordIds = [1, 2];
|
||||
const fieldIds = [1, 2];
|
||||
const dataFormat = DataFormat.Raw;
|
||||
|
||||
const request = new GetRecordsRequest(
|
||||
appId,
|
||||
recordIds,
|
||||
fieldIds,
|
||||
dataFormat
|
||||
);
|
||||
expect(request).to.have.property('appId', appId);
|
||||
expect(request).to.have.property('recordIds', recordIds);
|
||||
expect(request).to.have.property('fieldIds', fieldIds);
|
||||
expect(request).to.have.property('dataFormat', dataFormat);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
import { QueryRecordsRequest } from '../src/models/QueryRecordsRequest';
|
||||
import { expect } from 'chai';
|
||||
import { DataFormat } from '../src/enums/DataFormat';
|
||||
import { PagingRequest } from '../src/models/PagingRequest';
|
||||
|
||||
describe('QueryRecordsRequest', function () {
|
||||
it('should be defined', function () {
|
||||
expect(QueryRecordsRequest).to.not.be.undefined;
|
||||
});
|
||||
|
||||
it('should have a constructor', function () {
|
||||
expect(QueryRecordsRequest).to.have.property('constructor');
|
||||
});
|
||||
|
||||
it('should have a constructor that takes 2 parameters', function () {
|
||||
expect(QueryRecordsRequest).to.have.lengthOf(2);
|
||||
});
|
||||
|
||||
it('should have an appId property', function () {
|
||||
expect(new QueryRecordsRequest(1, 'filter')).to.have.property('appId');
|
||||
});
|
||||
|
||||
it('should have a filter property', function () {
|
||||
expect(new QueryRecordsRequest(1, 'filter')).to.have.property('filter');
|
||||
});
|
||||
|
||||
it('should have a fieldIds property', function () {
|
||||
expect(new QueryRecordsRequest(1, 'filter')).to.have.property('fieldIds');
|
||||
});
|
||||
|
||||
it('should have a dataFormat property', function () {
|
||||
expect(new QueryRecordsRequest(1, 'filter')).to.have.property('dataFormat');
|
||||
});
|
||||
|
||||
it('should have a pagingRequest property', function () {
|
||||
expect(new QueryRecordsRequest(1, 'filter')).to.have.property(
|
||||
'pagingRequest'
|
||||
);
|
||||
});
|
||||
|
||||
it('should have a constructor that sets its properties correctly', function () {
|
||||
const appId = 1;
|
||||
const filter = 'filter';
|
||||
const fieldIds = [1, 2, 3];
|
||||
const dataFormat = DataFormat.Raw;
|
||||
const pagingRequest = new PagingRequest(1, 50);
|
||||
|
||||
const request = new QueryRecordsRequest(
|
||||
appId,
|
||||
filter,
|
||||
fieldIds,
|
||||
dataFormat,
|
||||
pagingRequest
|
||||
);
|
||||
|
||||
expect(request).to.have.property('appId', appId);
|
||||
expect(request).to.have.property('filter', filter);
|
||||
expect(request).to.have.property('fieldIds', fieldIds);
|
||||
expect(request).to.have.property('dataFormat', dataFormat);
|
||||
expect(request).to.have.property('pagingRequest', pagingRequest);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user