@dmptool/types 1.2.6 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/answers/__tests__/defaults.spec.js +216 -0
- package/dist/answers/answer.d.ts +29 -14
- package/dist/answers/answer.js +11 -5
- package/dist/answers/dateAnswers.d.ts +20 -47
- package/dist/answers/dateAnswers.js +20 -10
- package/dist/answers/graphQLAnswers.d.ts +48 -120
- package/dist/answers/graphQLAnswers.js +46 -21
- package/dist/answers/index.d.ts +155 -1439
- package/dist/answers/index.js +26 -1
- package/dist/answers/numberAnswers.d.ts +38 -92
- package/dist/answers/numberAnswers.js +38 -19
- package/dist/answers/optionBasedAnswers.d.ts +42 -87
- package/dist/answers/optionBasedAnswers.js +37 -21
- package/dist/answers/tableAnswers.d.ts +348 -3032
- package/dist/answers/tableAnswers.js +25 -61
- package/dist/answers/textAnswers.d.ts +32 -68
- package/dist/answers/textAnswers.js +30 -17
- package/dist/dmp/__tests__/commonStandard.spec.d.ts +1 -0
- package/dist/dmp/__tests__/commonStandard.spec.js +210 -0
- package/dist/dmp/__tests__/extensions.spec.d.ts +1 -0
- package/dist/dmp/__tests__/extensions.spec.js +99 -0
- package/dist/dmp/extension.d.ts +1006 -0
- package/dist/dmp/extension.js +234 -0
- package/dist/dmp/index.d.ts +9 -0
- package/dist/dmp/index.js +23 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/questions/__tests__/dateQuestions.spec.js +3 -0
- package/dist/questions/__tests__/defaults.spec.d.ts +1 -0
- package/dist/questions/__tests__/defaults.spec.js +668 -0
- package/dist/questions/__tests__/optionBasedQuestions.spec.js +3 -2
- package/dist/questions/__tests__/tableQuestion.spec.js +22 -23
- package/dist/questions/__tests__/textQuestions.spec.js +32 -0
- package/dist/questions/dateQuestions.d.ts +45 -191
- package/dist/questions/dateQuestions.js +26 -23
- package/dist/questions/graphQLQuestions.d.ts +262 -556
- package/dist/questions/graphQLQuestions.js +225 -223
- package/dist/questions/index.d.ts +670 -7441
- package/dist/questions/index.js +26 -1
- package/dist/questions/numberQuestions.d.ts +85 -331
- package/dist/questions/numberQuestions.js +50 -36
- package/dist/questions/optionBasedQuestions.d.ts +83 -290
- package/dist/questions/optionBasedQuestions.js +58 -41
- package/dist/questions/question.d.ts +72 -35
- package/dist/questions/question.js +14 -5
- package/dist/questions/tableQuestions.d.ts +2228 -9599
- package/dist/questions/tableQuestions.js +185 -192
- package/dist/questions/textQuestions.d.ts +70 -226
- package/dist/questions/textQuestions.js +31 -31
- package/dist/schemas/affiliationSearchAnswer.schema.json +35 -33
- package/dist/schemas/affiliationSearchQuestion.schema.json +124 -122
- package/dist/schemas/anyAnswer.schema.json +1229 -408
- package/dist/schemas/anyQuestion.schema.json +4312 -2023
- package/dist/schemas/anyTableColumnAnswer.schema.json +535 -314
- package/dist/schemas/anyTableColumnQuestion.schema.json +1309 -874
- package/dist/schemas/booleanAnswer.schema.json +22 -23
- package/dist/schemas/booleanQuestion.schema.json +39 -43
- package/dist/schemas/checkboxesAnswer.schema.json +27 -28
- package/dist/schemas/checkboxesQuestion.schema.json +63 -62
- package/dist/schemas/currencyAnswer.schema.json +22 -23
- package/dist/schemas/currencyQuestion.schema.json +57 -54
- package/dist/schemas/dateAnswer.schema.json +22 -23
- package/dist/schemas/dateQuestion.schema.json +50 -49
- package/dist/schemas/dateRangeAnswer.schema.json +35 -33
- package/dist/schemas/dateRangeQuestion.schema.json +87 -78
- package/dist/schemas/dmp.schema.json +2070 -0
- package/dist/schemas/dmpExtension.schema.json +1874 -0
- package/dist/schemas/emailAnswer.schema.json +22 -23
- package/dist/schemas/emailQuestion.schema.json +55 -53
- package/dist/schemas/licenseSearchAnswer.schema.json +40 -38
- package/dist/schemas/licenseSearchQuestion.schema.json +122 -146
- package/dist/schemas/metadataStandardSearchAnswer.schema.json +40 -38
- package/dist/schemas/metadataStandardSearchQuestion.schema.json +123 -156
- package/dist/schemas/multiselectBoxAnswer.schema.json +27 -28
- package/dist/schemas/multiselectBoxQuestion.schema.json +70 -71
- package/dist/schemas/numberAnswer.schema.json +22 -23
- package/dist/schemas/numberQuestion.schema.json +52 -50
- package/dist/schemas/numberRangeAnswer.schema.json +35 -33
- package/dist/schemas/numberRangeQuestion.schema.json +91 -60
- package/dist/schemas/numberWithContextAnswer.schema.json +35 -33
- package/dist/schemas/numberWithContextQuestion.schema.json +81 -70
- package/dist/schemas/radioButtonsAnswer.schema.json +22 -23
- package/dist/schemas/radioButtonsQuestion.schema.json +63 -62
- package/dist/schemas/repositorySearchAnswer.schema.json +40 -38
- package/dist/schemas/repositorySearchQuestion.schema.json +122 -162
- package/dist/schemas/researchOutputTableAnswer.schema.json +16622 -411
- package/dist/schemas/researchOutputTableQuestion.schema.json +114 -1157
- package/dist/schemas/selectBoxAnswer.schema.json +22 -23
- package/dist/schemas/selectBoxQuestion.schema.json +70 -71
- package/dist/schemas/tableAnswer.schema.json +581 -360
- package/dist/schemas/tableQuestion.schema.json +1388 -942
- package/dist/schemas/textAnswer.schema.json +22 -23
- package/dist/schemas/textAreaAnswer.schema.json +22 -23
- package/dist/schemas/textAreaQuestion.schema.json +65 -57
- package/dist/schemas/textQuestion.schema.json +50 -49
- package/dist/schemas/urlAnswer.schema.json +22 -23
- package/dist/schemas/urlQuestion.schema.json +50 -49
- package/package.json +6 -4
- package/dist/answers/__tests__/usage.spec.js +0 -178
- package/dist/questions/__tests__/usage.spec.d.ts +0 -8
- package/dist/questions/__tests__/usage.spec.js +0 -473
- /package/dist/answers/__tests__/{usage.spec.d.ts → defaults.spec.d.ts} +0 -0
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const questions_1 = require("../../questions");
|
|
4
|
-
const index_1 = require("../index");
|
|
5
|
-
// Parse the Zod schema with no input to generate the default JSON schemas
|
|
6
|
-
function defaultJSON(name) {
|
|
7
|
-
if (name in index_1.AnswerSchemaMap) {
|
|
8
|
-
const schema = index_1.AnswerSchemaMap[name];
|
|
9
|
-
return schema.parse({ type: name });
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return null;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
describe('Get question answer defaultJSON', () => {
|
|
16
|
-
it('for affiliationSearch question format', () => {
|
|
17
|
-
const json = defaultJSON('affiliationSearch');
|
|
18
|
-
const expectedJSON = {
|
|
19
|
-
type: 'affiliationSearch',
|
|
20
|
-
answer: {
|
|
21
|
-
affiliationId: '',
|
|
22
|
-
affiliationName: '',
|
|
23
|
-
},
|
|
24
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
25
|
-
};
|
|
26
|
-
expect(json).toEqual(expectedJSON);
|
|
27
|
-
});
|
|
28
|
-
it('for boolean question format', () => {
|
|
29
|
-
const json = defaultJSON('boolean');
|
|
30
|
-
const expectedJSON = {
|
|
31
|
-
type: 'boolean',
|
|
32
|
-
answer: false,
|
|
33
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
34
|
-
};
|
|
35
|
-
expect(json).toEqual(expectedJSON);
|
|
36
|
-
});
|
|
37
|
-
it('for checkBoxes question format', () => {
|
|
38
|
-
const json = defaultJSON('checkBoxes');
|
|
39
|
-
const expectedJSON = {
|
|
40
|
-
type: 'checkBoxes',
|
|
41
|
-
answer: [''],
|
|
42
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
43
|
-
};
|
|
44
|
-
expect(json).toEqual(expectedJSON);
|
|
45
|
-
});
|
|
46
|
-
it('for currency question format', () => {
|
|
47
|
-
const json = defaultJSON('currency');
|
|
48
|
-
const expectedJSON = {
|
|
49
|
-
type: 'currency',
|
|
50
|
-
answer: 0,
|
|
51
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
52
|
-
};
|
|
53
|
-
expect(json).toEqual(expectedJSON);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
it('for date question format', () => {
|
|
57
|
-
const json = defaultJSON('date');
|
|
58
|
-
const expectedJSON = {
|
|
59
|
-
type: 'date',
|
|
60
|
-
answer: '',
|
|
61
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
62
|
-
};
|
|
63
|
-
expect(json).toEqual(expectedJSON);
|
|
64
|
-
});
|
|
65
|
-
it('for dateRange question format', () => {
|
|
66
|
-
const json = defaultJSON('dateRange');
|
|
67
|
-
const expectedJSON = {
|
|
68
|
-
type: 'dateRange',
|
|
69
|
-
answer: {
|
|
70
|
-
start: '',
|
|
71
|
-
end: '',
|
|
72
|
-
},
|
|
73
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
74
|
-
};
|
|
75
|
-
expect(json).toEqual(expectedJSON);
|
|
76
|
-
});
|
|
77
|
-
it('for email question format', () => {
|
|
78
|
-
const json = defaultJSON('email');
|
|
79
|
-
const expectedJSON = {
|
|
80
|
-
type: 'email',
|
|
81
|
-
answer: '',
|
|
82
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
83
|
-
};
|
|
84
|
-
expect(json).toEqual(expectedJSON);
|
|
85
|
-
});
|
|
86
|
-
it('for multiselectBox question format', () => {
|
|
87
|
-
const json = defaultJSON('multiselectBox');
|
|
88
|
-
const expectedJSON = {
|
|
89
|
-
type: 'multiselectBox',
|
|
90
|
-
answer: [''],
|
|
91
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
92
|
-
};
|
|
93
|
-
expect(json).toEqual(expectedJSON);
|
|
94
|
-
});
|
|
95
|
-
it('for number question format', () => {
|
|
96
|
-
const json = defaultJSON('number');
|
|
97
|
-
const expectedJSON = {
|
|
98
|
-
type: 'number',
|
|
99
|
-
answer: 0,
|
|
100
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
101
|
-
};
|
|
102
|
-
expect(json).toEqual(expectedJSON);
|
|
103
|
-
});
|
|
104
|
-
it('for numberRange format', () => {
|
|
105
|
-
const json = defaultJSON('numberRange');
|
|
106
|
-
const expectedJSON = {
|
|
107
|
-
type: 'numberRange',
|
|
108
|
-
answer: {
|
|
109
|
-
start: 0,
|
|
110
|
-
end: 0,
|
|
111
|
-
},
|
|
112
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
113
|
-
};
|
|
114
|
-
expect(json).toEqual(expectedJSON);
|
|
115
|
-
});
|
|
116
|
-
it('for radioButtons question format', () => {
|
|
117
|
-
const json = defaultJSON('radioButtons');
|
|
118
|
-
const expectedJSON = {
|
|
119
|
-
type: 'radioButtons',
|
|
120
|
-
answer: '',
|
|
121
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
122
|
-
};
|
|
123
|
-
expect(json).toEqual(expectedJSON);
|
|
124
|
-
});
|
|
125
|
-
it('for selectBox question format', () => {
|
|
126
|
-
const json = defaultJSON('selectBox');
|
|
127
|
-
const expectedJSON = {
|
|
128
|
-
type: 'selectBox',
|
|
129
|
-
answer: '',
|
|
130
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
131
|
-
};
|
|
132
|
-
expect(json).toEqual(expectedJSON);
|
|
133
|
-
});
|
|
134
|
-
it('for table question format', () => {
|
|
135
|
-
const json = defaultJSON('table');
|
|
136
|
-
const expectedJSON = {
|
|
137
|
-
type: 'table',
|
|
138
|
-
columnHeadings: [
|
|
139
|
-
'Column A',
|
|
140
|
-
],
|
|
141
|
-
answer: [{
|
|
142
|
-
columns: [{
|
|
143
|
-
type: 'textArea',
|
|
144
|
-
answer: '',
|
|
145
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
146
|
-
}],
|
|
147
|
-
}],
|
|
148
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
149
|
-
};
|
|
150
|
-
expect(json).toEqual(expectedJSON);
|
|
151
|
-
});
|
|
152
|
-
it('for text question format', () => {
|
|
153
|
-
const json = defaultJSON('text');
|
|
154
|
-
const expectedJSON = {
|
|
155
|
-
type: 'text',
|
|
156
|
-
answer: '',
|
|
157
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
158
|
-
};
|
|
159
|
-
expect(json).toEqual(expectedJSON);
|
|
160
|
-
});
|
|
161
|
-
it('for textArea question format', () => {
|
|
162
|
-
const json = defaultJSON('textArea');
|
|
163
|
-
const expectedJSON = {
|
|
164
|
-
type: 'textArea',
|
|
165
|
-
answer: '',
|
|
166
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
167
|
-
};
|
|
168
|
-
expect(json).toEqual(expectedJSON);
|
|
169
|
-
});
|
|
170
|
-
it('for url question format', () => {
|
|
171
|
-
const json = defaultJSON('url');
|
|
172
|
-
const expectedJSON = {
|
|
173
|
-
type: 'url',
|
|
174
|
-
answer: '',
|
|
175
|
-
meta: { schemaVersion: questions_1.CURRENT_SCHEMA_VERSION },
|
|
176
|
-
};
|
|
177
|
-
expect(json).toEqual(expectedJSON);
|
|
178
|
-
});
|
|
@@ -1,473 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const question_1 = require("../question");
|
|
4
|
-
const index_1 = require("../index");
|
|
5
|
-
// Parse the Zod schema with no input to generate the default JSON schemas
|
|
6
|
-
function questionFormatInfo(name) {
|
|
7
|
-
if (name in index_1.QuestionSchemaMap) {
|
|
8
|
-
const usage = question_1.QuestionFormatsUsage[name];
|
|
9
|
-
const schema = index_1.QuestionSchemaMap[name];
|
|
10
|
-
const parsedSchema = schema.parse({ type: name });
|
|
11
|
-
return {
|
|
12
|
-
type: name,
|
|
13
|
-
title: usage === null || usage === void 0 ? void 0 : usage.title,
|
|
14
|
-
usageDescription: usage === null || usage === void 0 ? void 0 : usage.usageDescription,
|
|
15
|
-
defaultJSON: parsedSchema
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
describe('Get question format information', () => {
|
|
23
|
-
it('for affiliationSearch question format', () => {
|
|
24
|
-
const format = questionFormatInfo('affiliationSearch');
|
|
25
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('affiliationSearch');
|
|
26
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Affiliation Search');
|
|
27
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
28
|
-
const expectedJSON = {
|
|
29
|
-
type: 'affiliationSearch',
|
|
30
|
-
attributes: {},
|
|
31
|
-
meta: { schemaVersion: '1.0' },
|
|
32
|
-
graphQL: {
|
|
33
|
-
displayFields: [{
|
|
34
|
-
label: "Institution",
|
|
35
|
-
propertyName: "displayName",
|
|
36
|
-
}],
|
|
37
|
-
query: index_1.affiliationQuery,
|
|
38
|
-
responseField: 'affiliations.items',
|
|
39
|
-
variables: [{
|
|
40
|
-
label: "Search for your institution",
|
|
41
|
-
minLength: 3,
|
|
42
|
-
name: "name",
|
|
43
|
-
type: "string",
|
|
44
|
-
}],
|
|
45
|
-
answerField: 'uri'
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
49
|
-
});
|
|
50
|
-
it('for boolean question format', () => {
|
|
51
|
-
const format = questionFormatInfo('boolean');
|
|
52
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('boolean');
|
|
53
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Yes/No Field');
|
|
54
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
55
|
-
const expectedJSON = {
|
|
56
|
-
type: 'boolean',
|
|
57
|
-
attributes: { checked: false },
|
|
58
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
59
|
-
};
|
|
60
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
61
|
-
});
|
|
62
|
-
it('for checkBoxes question format', () => {
|
|
63
|
-
const format = questionFormatInfo('checkBoxes');
|
|
64
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('checkBoxes');
|
|
65
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Check Boxes');
|
|
66
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
67
|
-
const expectedJSON = {
|
|
68
|
-
type: 'checkBoxes',
|
|
69
|
-
attributes: {},
|
|
70
|
-
options: [{
|
|
71
|
-
label: 'Option A',
|
|
72
|
-
value: 'a',
|
|
73
|
-
checked: false
|
|
74
|
-
}],
|
|
75
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
76
|
-
};
|
|
77
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
78
|
-
});
|
|
79
|
-
it('for currency question format', () => {
|
|
80
|
-
const format = questionFormatInfo('currency');
|
|
81
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('currency');
|
|
82
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Currency Field');
|
|
83
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
84
|
-
const expectedJSON = {
|
|
85
|
-
type: 'currency',
|
|
86
|
-
attributes: {
|
|
87
|
-
denomination: 'USD',
|
|
88
|
-
min: 0,
|
|
89
|
-
step: 1
|
|
90
|
-
},
|
|
91
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
92
|
-
};
|
|
93
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
it('for date question format', () => {
|
|
97
|
-
const format = questionFormatInfo('date');
|
|
98
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('date');
|
|
99
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Date Field');
|
|
100
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
101
|
-
const expectedJSON = {
|
|
102
|
-
type: 'date',
|
|
103
|
-
attributes: {
|
|
104
|
-
step: 1
|
|
105
|
-
},
|
|
106
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
107
|
-
};
|
|
108
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
109
|
-
});
|
|
110
|
-
it('for dateRange question format', () => {
|
|
111
|
-
const format = questionFormatInfo('dateRange');
|
|
112
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('dateRange');
|
|
113
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Date Range');
|
|
114
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
115
|
-
const expectedJSON = {
|
|
116
|
-
type: 'dateRange',
|
|
117
|
-
attributes: {},
|
|
118
|
-
columns: {
|
|
119
|
-
start: {
|
|
120
|
-
label: 'From',
|
|
121
|
-
step: 1
|
|
122
|
-
},
|
|
123
|
-
end: {
|
|
124
|
-
label: 'To',
|
|
125
|
-
step: 1
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
129
|
-
};
|
|
130
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
131
|
-
});
|
|
132
|
-
it('for email question format', () => {
|
|
133
|
-
const format = questionFormatInfo('email');
|
|
134
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('email');
|
|
135
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Email Field');
|
|
136
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
137
|
-
const expectedJSON = {
|
|
138
|
-
type: 'email',
|
|
139
|
-
attributes: {
|
|
140
|
-
maxLength: 255,
|
|
141
|
-
multiple: false,
|
|
142
|
-
},
|
|
143
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
144
|
-
};
|
|
145
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
146
|
-
});
|
|
147
|
-
it('for licenseSearch question format', () => {
|
|
148
|
-
const format = questionFormatInfo('licenseSearch');
|
|
149
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('licenseSearch');
|
|
150
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('License Search');
|
|
151
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
152
|
-
const expectedJSON = {
|
|
153
|
-
type: 'licenseSearch',
|
|
154
|
-
attributes: {},
|
|
155
|
-
meta: { schemaVersion: '1.0' },
|
|
156
|
-
graphQL: {
|
|
157
|
-
displayFields: [
|
|
158
|
-
{
|
|
159
|
-
label: "Name",
|
|
160
|
-
propertyName: "name",
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
label: "Description",
|
|
164
|
-
propertyName: "description",
|
|
165
|
-
},
|
|
166
|
-
{
|
|
167
|
-
label: "Recommended",
|
|
168
|
-
propertyName: "recommended",
|
|
169
|
-
}
|
|
170
|
-
],
|
|
171
|
-
query: index_1.licenseQuery,
|
|
172
|
-
responseField: 'licenses.items',
|
|
173
|
-
variables: [
|
|
174
|
-
{
|
|
175
|
-
label: "Search for a license",
|
|
176
|
-
minLength: 3,
|
|
177
|
-
name: "term",
|
|
178
|
-
type: "string",
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
label: "Pagination Options",
|
|
182
|
-
name: "paginationOptions",
|
|
183
|
-
type: "paginationOptions",
|
|
184
|
-
}
|
|
185
|
-
],
|
|
186
|
-
answerField: 'uri'
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
190
|
-
});
|
|
191
|
-
it('for metadataStandardSearch question format', () => {
|
|
192
|
-
const format = questionFormatInfo('metadataStandardSearch');
|
|
193
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('metadataStandardSearch');
|
|
194
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Metadata Standard Search');
|
|
195
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
196
|
-
const expectedJSON = {
|
|
197
|
-
type: 'metadataStandardSearch',
|
|
198
|
-
attributes: {},
|
|
199
|
-
meta: { schemaVersion: '1.0' },
|
|
200
|
-
graphQL: {
|
|
201
|
-
displayFields: [
|
|
202
|
-
{
|
|
203
|
-
label: "Name",
|
|
204
|
-
propertyName: "name",
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
label: "Description",
|
|
208
|
-
propertyName: "description",
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
label: "Website",
|
|
212
|
-
propertyName: "website",
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
label: "Subject Areas",
|
|
216
|
-
propertyName: "keywords",
|
|
217
|
-
}
|
|
218
|
-
],
|
|
219
|
-
query: index_1.metadataStandardQuery,
|
|
220
|
-
responseField: 'metadataStandards.items',
|
|
221
|
-
variables: [
|
|
222
|
-
{
|
|
223
|
-
label: "Search for a metadata standard",
|
|
224
|
-
minLength: 3,
|
|
225
|
-
name: "term",
|
|
226
|
-
type: "string",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
label: "Subject Areas",
|
|
230
|
-
name: "keywords",
|
|
231
|
-
type: "string",
|
|
232
|
-
minLength: 3,
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
label: "Pagination Options",
|
|
236
|
-
name: "paginationOptions",
|
|
237
|
-
type: "paginationOptions",
|
|
238
|
-
}
|
|
239
|
-
],
|
|
240
|
-
answerField: 'uri'
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
244
|
-
});
|
|
245
|
-
it('for multiselectBox question format', () => {
|
|
246
|
-
const format = questionFormatInfo('multiselectBox');
|
|
247
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('multiselectBox');
|
|
248
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Multi-select Box');
|
|
249
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
250
|
-
const expectedJSON = {
|
|
251
|
-
type: 'multiselectBox',
|
|
252
|
-
attributes: {
|
|
253
|
-
multiple: true,
|
|
254
|
-
},
|
|
255
|
-
options: [{
|
|
256
|
-
label: 'Option A',
|
|
257
|
-
value: 'a',
|
|
258
|
-
selected: false
|
|
259
|
-
}],
|
|
260
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
261
|
-
};
|
|
262
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
263
|
-
});
|
|
264
|
-
it('for number question format', () => {
|
|
265
|
-
const format = questionFormatInfo('number');
|
|
266
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('number');
|
|
267
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Number Field');
|
|
268
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
269
|
-
const expectedJSON = {
|
|
270
|
-
type: 'number',
|
|
271
|
-
attributes: {
|
|
272
|
-
min: 0,
|
|
273
|
-
step: 1,
|
|
274
|
-
},
|
|
275
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
276
|
-
};
|
|
277
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
278
|
-
});
|
|
279
|
-
it('for numberRange format', () => {
|
|
280
|
-
const format = questionFormatInfo('numberRange');
|
|
281
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('numberRange');
|
|
282
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Number Range');
|
|
283
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
284
|
-
const expectedJSON = {
|
|
285
|
-
type: 'numberRange',
|
|
286
|
-
attributes: {},
|
|
287
|
-
columns: {
|
|
288
|
-
start: {
|
|
289
|
-
label: 'From',
|
|
290
|
-
min: 0,
|
|
291
|
-
step: 1,
|
|
292
|
-
},
|
|
293
|
-
end: {
|
|
294
|
-
label: 'To',
|
|
295
|
-
min: 0,
|
|
296
|
-
step: 1,
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
300
|
-
};
|
|
301
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
302
|
-
});
|
|
303
|
-
it('for radioButtons question format', () => {
|
|
304
|
-
const format = questionFormatInfo('radioButtons');
|
|
305
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('radioButtons');
|
|
306
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Radio Buttons');
|
|
307
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
308
|
-
const expectedJSON = {
|
|
309
|
-
type: 'radioButtons',
|
|
310
|
-
attributes: {},
|
|
311
|
-
options: [{
|
|
312
|
-
label: 'Option A',
|
|
313
|
-
value: 'a',
|
|
314
|
-
selected: false
|
|
315
|
-
}],
|
|
316
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
317
|
-
};
|
|
318
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
319
|
-
});
|
|
320
|
-
it('for repositorySearch question format', () => {
|
|
321
|
-
const format = questionFormatInfo('repositorySearch');
|
|
322
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('repositorySearch');
|
|
323
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Repository Search');
|
|
324
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
325
|
-
const expectedJSON = {
|
|
326
|
-
type: 'repositorySearch',
|
|
327
|
-
attributes: {},
|
|
328
|
-
meta: { schemaVersion: '1.0' },
|
|
329
|
-
graphQL: {
|
|
330
|
-
displayFields: [
|
|
331
|
-
{
|
|
332
|
-
label: "Name",
|
|
333
|
-
propertyName: "name",
|
|
334
|
-
},
|
|
335
|
-
{
|
|
336
|
-
label: "Description",
|
|
337
|
-
propertyName: "description",
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
label: "Website",
|
|
341
|
-
propertyName: "website",
|
|
342
|
-
},
|
|
343
|
-
{
|
|
344
|
-
label: "Subject Areas",
|
|
345
|
-
propertyName: "keywords",
|
|
346
|
-
}
|
|
347
|
-
],
|
|
348
|
-
query: index_1.repositoryQuery,
|
|
349
|
-
responseField: 'repositories.items',
|
|
350
|
-
variables: [
|
|
351
|
-
{
|
|
352
|
-
label: "Search for a repository",
|
|
353
|
-
minLength: 3,
|
|
354
|
-
name: "term",
|
|
355
|
-
type: "string",
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
label: "Subject Areas",
|
|
359
|
-
name: "keywords",
|
|
360
|
-
type: "string",
|
|
361
|
-
minLength: 3
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
label: "Repository type",
|
|
365
|
-
name: "repositoryType",
|
|
366
|
-
type: "string",
|
|
367
|
-
minLength: 3
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
label: "Pagination Options",
|
|
371
|
-
name: "paginationOptions",
|
|
372
|
-
type: "paginationOptions",
|
|
373
|
-
}
|
|
374
|
-
],
|
|
375
|
-
answerField: 'uri'
|
|
376
|
-
}
|
|
377
|
-
};
|
|
378
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
379
|
-
});
|
|
380
|
-
it('for selectBox question format', () => {
|
|
381
|
-
const format = questionFormatInfo('selectBox');
|
|
382
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('selectBox');
|
|
383
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Select Box');
|
|
384
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
385
|
-
const expectedJSON = {
|
|
386
|
-
type: 'selectBox',
|
|
387
|
-
attributes: {
|
|
388
|
-
multiple: false,
|
|
389
|
-
},
|
|
390
|
-
options: [{
|
|
391
|
-
label: 'Option A',
|
|
392
|
-
value: 'a',
|
|
393
|
-
selected: false
|
|
394
|
-
}],
|
|
395
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
396
|
-
};
|
|
397
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
398
|
-
});
|
|
399
|
-
it('for table question format', () => {
|
|
400
|
-
const format = questionFormatInfo('table');
|
|
401
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('table');
|
|
402
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Table');
|
|
403
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
404
|
-
const expectedJSON = {
|
|
405
|
-
type: 'table',
|
|
406
|
-
attributes: {
|
|
407
|
-
canAddRows: true,
|
|
408
|
-
canRemoveRows: true,
|
|
409
|
-
initialRows: 1
|
|
410
|
-
},
|
|
411
|
-
columns: [{
|
|
412
|
-
heading: 'Column A',
|
|
413
|
-
enabled: true,
|
|
414
|
-
required: false,
|
|
415
|
-
content: {
|
|
416
|
-
type: 'textArea',
|
|
417
|
-
attributes: {
|
|
418
|
-
asRichText: true,
|
|
419
|
-
cols: 20,
|
|
420
|
-
rows: 2,
|
|
421
|
-
},
|
|
422
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION }
|
|
423
|
-
},
|
|
424
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION }
|
|
425
|
-
}],
|
|
426
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
427
|
-
};
|
|
428
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
429
|
-
});
|
|
430
|
-
it('for text question format', () => {
|
|
431
|
-
const format = questionFormatInfo('text');
|
|
432
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('text');
|
|
433
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Text Field');
|
|
434
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
435
|
-
const expectedJSON = {
|
|
436
|
-
type: 'text',
|
|
437
|
-
attributes: {
|
|
438
|
-
maxLength: 255,
|
|
439
|
-
},
|
|
440
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
441
|
-
};
|
|
442
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
443
|
-
});
|
|
444
|
-
it('for textArea question format', () => {
|
|
445
|
-
const format = questionFormatInfo('textArea');
|
|
446
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('textArea');
|
|
447
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('Text Area');
|
|
448
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
449
|
-
const expectedJSON = {
|
|
450
|
-
type: 'textArea',
|
|
451
|
-
attributes: {
|
|
452
|
-
asRichText: true,
|
|
453
|
-
cols: 20,
|
|
454
|
-
rows: 2,
|
|
455
|
-
},
|
|
456
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
457
|
-
};
|
|
458
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
459
|
-
});
|
|
460
|
-
it('for url question format', () => {
|
|
461
|
-
const format = questionFormatInfo('url');
|
|
462
|
-
expect(format === null || format === void 0 ? void 0 : format.type).toEqual('url');
|
|
463
|
-
expect(format === null || format === void 0 ? void 0 : format.title).toEqual('URL Field');
|
|
464
|
-
expect(format === null || format === void 0 ? void 0 : format.usageDescription).toBeDefined();
|
|
465
|
-
const expectedJSON = {
|
|
466
|
-
type: 'url',
|
|
467
|
-
attributes: {
|
|
468
|
-
maxLength: 255,
|
|
469
|
-
},
|
|
470
|
-
meta: { schemaVersion: question_1.CURRENT_SCHEMA_VERSION },
|
|
471
|
-
};
|
|
472
|
-
expect(format === null || format === void 0 ? void 0 : format.defaultJSON).toEqual(expectedJSON);
|
|
473
|
-
});
|
|
File without changes
|