2023-02-09 22:21:20 -06:00
|
|
|
import { Record } from '../src/models/Record';
|
|
|
|
|
import { expect } from 'chai';
|
|
|
|
|
import { RecordValueType } from '../src/enums/RecordValueType';
|
2023-02-10 23:22:41 -06:00
|
|
|
import { RecordValue } from '../src/models/RecordValue';
|
2023-02-09 22:21:20 -06:00
|
|
|
|
|
|
|
|
describe('Record', function () {
|
|
|
|
|
it('should be defined', function () {
|
|
|
|
|
expect(Record).to.not.be.undefined;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a constructor', function () {
|
|
|
|
|
expect(Record).to.have.property('constructor');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a constructor that has 3 parameters', function () {
|
|
|
|
|
expect(Record).to.have.lengthOf(3);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a constructor that sets its properties correctly', function () {
|
|
|
|
|
const record = new Record(1, 2, [
|
2023-02-10 23:22:41 -06:00
|
|
|
new RecordValue(RecordValueType.String, 1, 'test'),
|
|
|
|
|
new RecordValue(RecordValueType.String, 2, 'test'),
|
2023-02-09 22:21:20 -06:00
|
|
|
]);
|
|
|
|
|
expect(record).to.have.property('appId', 1);
|
|
|
|
|
expect(record).to.have.property('recordId', 2);
|
|
|
|
|
expect(record)
|
|
|
|
|
.to.have.property('fieldData')
|
|
|
|
|
.that.is.an('array')
|
|
|
|
|
.with.lengthOf(2);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have an appId property', function () {
|
|
|
|
|
expect(
|
|
|
|
|
new Record(1, 2, [
|
2023-02-10 23:22:41 -06:00
|
|
|
new RecordValue(RecordValueType.String, 1, 'test'),
|
|
|
|
|
new RecordValue(RecordValueType.String, 2, 'test'),
|
2023-02-09 22:21:20 -06:00
|
|
|
])
|
|
|
|
|
).to.have.property('appId');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a recordId property', function () {
|
|
|
|
|
expect(
|
|
|
|
|
new Record(1, 2, [
|
2023-02-10 23:22:41 -06:00
|
|
|
new RecordValue(RecordValueType.String, 1, 'test'),
|
|
|
|
|
new RecordValue(RecordValueType.String, 2, 'test'),
|
2023-02-09 22:21:20 -06:00
|
|
|
])
|
|
|
|
|
).to.have.property('recordId');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should have a fieldData property', function () {
|
|
|
|
|
expect(
|
|
|
|
|
new Record(1, 2, [
|
2023-02-10 23:22:41 -06:00
|
|
|
new RecordValue(RecordValueType.String, 1, 'test'),
|
|
|
|
|
new RecordValue(RecordValueType.String, 2, 'test'),
|
2023-02-09 22:21:20 -06:00
|
|
|
])
|
|
|
|
|
).to.have.property('fieldData');
|
|
|
|
|
});
|
|
|
|
|
});
|