-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestionnaireType.test.ts
38 lines (34 loc) · 1.12 KB
/
questionnaireType.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import getField from './../src/components/formPage/questionnaireType';
/* These tests act as validation criteria for the acceptance criteria for the client-side UI form generation of Questionnaires
with validation, type and error checking as defined in our documentation
https://github.com/TiagoF99/CSC302-Patient-Questionnaire/blob/main/Documentation/a3-features.md */
describe('test get Field', function () {
it('test string field', () => {
var item = {
linkId: '1',
text: 'test',
type: 'string',
};
const res = getField(item, {}, {});
expect(res.props).toEqual({ type: 'text', name: '1' });
});
it('test date field', () => {
var item = {
linkId: '1',
text: 'test',
type: 'date',
};
const res = getField(item, {}, {});
expect(res.props).toEqual({ type: 'date', name: '1' });
});
it('test decimal field', () => {
var item = {
linkId: '1',
text: 'test',
type: 'decimal',
};
const res = getField(item, {}, {});
expect(res.props.name).toEqual('1');
expect(res.props.placeholder).toEqual('Decimal Value (ex. 2.25)');
});
});