fix: implement formula field, list field, and reference field as chilrden of the field class. fix: when converting api response data to appropriate field response make sure json field objects are converted to correct field class based upon type.

This commit is contained in:
StevanFreeborn
2023-02-04 22:00:19 -06:00
parent 48de5ec3b8
commit e6eae35e03
11 changed files with 717 additions and 34 deletions
+98
View File
@@ -0,0 +1,98 @@
import { ListField } from '../src/models/ListField';
import { expect } from 'chai';
describe('ListField', function () {
it('should be defined', function () {
expect(ListField).to.not.be.undefined;
});
it('should be a function', function () {
expect(ListField).to.be.a('function');
});
it('should have a constructor', function () {
expect(ListField).to.have.property('constructor');
});
it('should throw an error if the multiplicity is not valid', function () {
expect(
() =>
new ListField(
1,
1,
'List Field',
'List',
'Enabled',
false,
false,
'Alone',
1,
[]
)
).to.throw();
});
it('should create a new ListField', function () {
const listField = new ListField(
1,
1,
'List Field',
'List',
'Enabled',
false,
false,
'SingleSelect',
1,
[]
);
expect(listField).to.be.an.instanceOf(ListField);
});
it('should have a multiplicity property', function () {
const listField = new ListField(
1,
1,
'List Field',
'List',
'Enabled',
false,
false,
'SingleSelect',
1,
[]
);
expect(listField).to.have.property('multiplicity');
});
it('should have a listId property', function () {
const listField = new ListField(
1,
1,
'List Field',
'List',
'Enabled',
false,
false,
'SingleSelect',
1,
[]
);
expect(listField).to.have.property('listId');
});
it('should have a values property', function () {
const listField = new ListField(
1,
1,
'List Field',
'List',
'Enabled',
false,
false,
'SingleSelect',
1,
[]
);
expect(listField).to.have.property('values');
});
});