@kineticdata/react 5.1.2 → 6.0.1
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/assets/task/icons/drag-handle.svg +3 -0
- package/assets/task/icons/plus_small.svg +2 -4
- package/lib/apis/agent/adapters.js +16 -12
- package/lib/apis/agent/bridges.js +54 -41
- package/lib/apis/agent/handlers.js +51 -38
- package/lib/apis/core/activity.js +19 -11
- package/lib/apis/core/attributeDefinitions.js +54 -46
- package/lib/apis/core/attributeDefinitions.test.js +47 -55
- package/lib/apis/core/authentication.js +58 -63
- package/lib/apis/core/backgroundJobs.js +38 -30
- package/lib/apis/core/bridgeModelAttributeMappings.js +42 -34
- package/lib/apis/core/bridgeModelAttributes.js +47 -37
- package/lib/apis/core/bridgeModelMappings.js +42 -34
- package/lib/apis/core/bridgeModelQualificationMappings.js +42 -34
- package/lib/apis/core/bridgeModelQualifications.js +42 -34
- package/lib/apis/core/bridgeModels.js +56 -46
- package/lib/apis/core/bridgeModels.test.js +64 -80
- package/lib/apis/core/bridgedresources.js +64 -72
- package/lib/apis/core/bridgedresources.test.js +33 -30
- package/lib/apis/core/categories.js +59 -52
- package/lib/apis/core/categories.test.js +36 -33
- package/lib/apis/core/fileResources.js +41 -33
- package/lib/apis/core/filestores.js +42 -34
- package/lib/apis/core/formTypes.js +50 -44
- package/lib/apis/core/forms.js +53 -49
- package/lib/apis/core/forms.test.js +60 -74
- package/lib/apis/core/kapps.js +45 -39
- package/lib/apis/core/kapps.test.js +45 -52
- package/lib/apis/core/logs.js +20 -16
- package/lib/apis/core/memberships.js +23 -20
- package/lib/apis/core/meta.js +31 -19
- package/lib/apis/core/notices.js +17 -9
- package/lib/apis/core/oauthClients.js +49 -45
- package/lib/apis/core/platformComponents.js +73 -57
- package/lib/apis/core/platformItems.js +22 -13
- package/lib/apis/core/profile.js +28 -21
- package/lib/apis/core/profile.test.js +20 -17
- package/lib/apis/core/securityPolicyDefinitions.js +48 -41
- package/lib/apis/core/securityPolicyDefinitions.test.js +50 -60
- package/lib/apis/core/space.js +23 -16
- package/lib/apis/core/space.test.js +31 -38
- package/lib/apis/core/submissions.js +213 -186
- package/lib/apis/core/submissions.test.js +39 -36
- package/lib/apis/core/teams.js +51 -44
- package/lib/apis/core/teams.test.js +42 -39
- package/lib/apis/core/translations.js +123 -130
- package/lib/apis/core/translations.test.js +278 -368
- package/lib/apis/core/users.js +56 -49
- package/lib/apis/core/users.test.js +42 -39
- package/lib/apis/core/version.js +20 -11
- package/lib/apis/core/webApis.js +42 -34
- package/lib/apis/core/webhooks.js +48 -41
- package/lib/apis/core/webhooks.test.js +50 -60
- package/lib/apis/core/webhooksJobs.js +30 -26
- package/lib/apis/core/workflows.js +52 -44
- package/lib/apis/http.js +121 -80
- package/lib/apis/http.test.js +137 -38
- package/lib/apis/index.js +506 -50
- package/lib/apis/system/index.js +363 -215
- package/lib/apis/task/index.js +294 -227
- package/lib/components/agent/bridge/BridgeForm.js +50 -50
- package/lib/components/agent/bridge/BridgeTable.js +16 -9
- package/lib/components/agent/filestore/FilestoreForm.js +49 -48
- package/lib/components/agent/filestore/FilestoreTable.js +16 -9
- package/lib/components/agent/handler/AgentHandlerForm.js +24 -27
- package/lib/components/agent/handler/AgentHandlerTable.js +17 -10
- package/lib/components/common/AttributeSelect.js +15 -9
- package/lib/components/common/BridgeSelect.js +48 -43
- package/lib/components/common/ComponentConfigContext.js +9 -2
- package/lib/components/common/ContentEditable.js +36 -60
- package/lib/components/common/FormSelect.js +70 -58
- package/lib/components/common/NodeSelect.js +23 -19
- package/lib/components/common/Scroller.js +24 -23
- package/lib/components/common/StaticSelect.js +57 -50
- package/lib/components/common/TableInput.js +54 -57
- package/lib/components/common/TeamSelect.js +42 -39
- package/lib/components/common/ToastContainer.js +170 -0
- package/lib/components/common/Typeahead.js +121 -138
- package/lib/components/common/UserSelect.js +42 -41
- package/lib/components/common/authentication/AuthInterceptor.js +15 -19
- package/lib/components/common/authentication/AuthInterceptor.test.js +46 -64
- package/lib/components/common/authentication/AuthenticationContainer.js +350 -454
- package/lib/components/common/authentication/RequestInterceptor.js +16 -19
- package/lib/components/common/code_input/CodeInput.js +92 -122
- package/lib/components/common/code_input/draftHelpers.js +96 -90
- package/lib/components/common/code_input/languageHelpers.js +49 -47
- package/lib/components/common/code_input/languageHelpers.test.js +21 -16
- package/lib/components/common/defaults/Toast.js +26 -0
- package/lib/components/common/defaults/index.js +13 -0
- package/lib/components/core/CoreFormModal.js +26 -24
- package/lib/components/core/CoreModal.js +37 -31
- package/lib/components/core/attribute_definition/AttributeDefinitionForm.js +24 -23
- package/lib/components/core/attribute_definition/AttributeDefinitionTable.js +25 -18
- package/lib/components/core/bridge_model/BridgeModelForm.js +27 -37
- package/lib/components/core/bridge_model/BridgeModelTable.js +17 -10
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeForm.js +17 -16
- package/lib/components/core/bridge_model_attribute/BridgeModelAttributeTable.js +25 -21
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationForm.js +20 -20
- package/lib/components/core/bridge_model_qualification/BridgeModelQualificationTable.js +27 -22
- package/lib/components/core/category/CategoryForm.js +22 -22
- package/lib/components/core/category/CategoryTable.js +28 -16
- package/lib/components/core/core_form/CoreForm.js +209 -285
- package/lib/components/core/core_form/CoreForm.test.js +12 -10
- package/lib/components/core/core_form/defaults/index.js +52 -44
- package/lib/components/core/core_form/globals.js +14 -5
- package/lib/components/core/field_definition/FieldDefinitionForm.js +23 -21
- package/lib/components/core/field_definition/FieldDefinitionTable.js +26 -15
- package/lib/components/core/file_resource/FileResourceForm.js +38 -37
- package/lib/components/core/file_resource/FileResourceTable.js +16 -12
- package/lib/components/core/form/FormForm.js +56 -61
- package/lib/components/core/form/FormTable.js +47 -33
- package/lib/components/core/form_type/FormTypeForm.js +14 -13
- package/lib/components/core/form_type/FormTypeTable.js +15 -9
- package/lib/components/core/i18n/I18n.js +54 -61
- package/lib/components/core/i18n/I18nContext.js +9 -2
- package/lib/components/core/i18n/I18nProvider.js +40 -43
- package/lib/components/core/i18n/Moment.js +40 -50
- package/lib/components/core/index_definition/IndexDefinitionForm.js +23 -24
- package/lib/components/core/index_definition/IndexDefinitionTable.js +31 -16
- package/lib/components/core/index_job/IndexJobTable.js +20 -15
- package/lib/components/core/kapp/KappForm.js +57 -58
- package/lib/components/core/kapp/KappTable.js +34 -44
- package/lib/components/core/log/LogTable.js +42 -34
- package/lib/components/core/oauth_client/OAuthClientForm.js +17 -17
- package/lib/components/core/oauth_client/OAuthClientTable.js +12 -8
- package/lib/components/core/platform_component/AgentComponentForm.js +15 -15
- package/lib/components/core/platform_component/AgentComponentTable.js +10 -5
- package/lib/components/core/platform_component/TaskComponentForm.js +14 -14
- package/lib/components/core/profile/ProfileForm.js +40 -39
- package/lib/components/core/security_definition/SecurityDefinitionForm.js +28 -25
- package/lib/components/core/security_definition/SecurityDefinitionTable.js +27 -17
- package/lib/components/core/space/SpaceForm.js +79 -90
- package/lib/components/core/submission/DatastoreSubmissionFilters.js +39 -40
- package/lib/components/core/submission/DatastoreSubmissionTable.js +37 -34
- package/lib/components/core/submission/FormSubmissionFilters.js +79 -75
- package/lib/components/core/submission/FormSubmissionTable.js +64 -39
- package/lib/components/core/submission/KappSubmissionTable.js +67 -48
- package/lib/components/core/submission/SubmissionForm.js +126 -55
- package/lib/components/core/submission/SubmissionTable.js +24 -20
- package/lib/components/core/submission/helpers.js +37 -33
- package/lib/components/core/submission/helpers.test.js +69 -20
- package/lib/components/core/team/TeamForm.js +24 -21
- package/lib/components/core/team/TeamTable.js +27 -16
- package/lib/components/core/translation/ContextForm.js +13 -10
- package/lib/components/core/translation/ContextTable.js +13 -10
- package/lib/components/core/translation/EntryForm.js +27 -24
- package/lib/components/core/translation/EntryTable.js +19 -16
- package/lib/components/core/translation/LocaleForm.js +16 -13
- package/lib/components/core/translation/LocaleTable.js +12 -8
- package/lib/components/core/user/UserForm.js +38 -37
- package/lib/components/core/user/UserTable.js +42 -20
- package/lib/components/core/webapi/WebApiForm.js +87 -80
- package/lib/components/core/webapi/WebApiTable.js +28 -17
- package/lib/components/core/webhook/WebhookForm.js +33 -32
- package/lib/components/core/webhook/WebhookTable.js +41 -29
- package/lib/components/core/webhook_job/WebhookJobTable.js +58 -35
- package/lib/components/form/Form.helpers.js +182 -108
- package/lib/components/form/Form.js +467 -524
- package/lib/components/form/Form.models.js +39 -24
- package/lib/components/form/FormState.js +8 -5
- package/lib/components/form/KitchenSinkForm.js +135 -4
- package/lib/components/form/defaults/AttributesField.js +48 -59
- package/lib/components/form/defaults/CheckboxField.js +14 -6
- package/lib/components/form/defaults/CodeField.js +15 -7
- package/lib/components/form/defaults/FormButtons.js +12 -4
- package/lib/components/form/defaults/FormError.js +12 -4
- package/lib/components/form/defaults/FormField.js +15 -7
- package/lib/components/form/defaults/FormLayout.js +12 -4
- package/lib/components/form/defaults/FormMultiField.js +15 -7
- package/lib/components/form/defaults/PasswordField.js +14 -6
- package/lib/components/form/defaults/RadioField.js +15 -7
- package/lib/components/form/defaults/SampleTeamsRolesFIeld.js +17 -9
- package/lib/components/form/defaults/SelectField.js +16 -8
- package/lib/components/form/defaults/SelectMultiField.js +15 -7
- package/lib/components/form/defaults/TableField.js +14 -6
- package/lib/components/form/defaults/TeamField.js +15 -7
- package/lib/components/form/defaults/TeamMultiField.js +15 -7
- package/lib/components/form/defaults/TextField.js +14 -6
- package/lib/components/form/defaults/TextMultiField.js +26 -28
- package/lib/components/form/defaults/UserField.js +15 -7
- package/lib/components/form/defaults/UserMultiField.js +15 -7
- package/lib/components/form/defaults/index.js +48 -41
- package/lib/components/form/tests/Form.test.js +568 -864
- package/lib/components/form/tests/components.js +15 -25
- package/lib/components/form/tests/helpers.test.js +35 -33
- package/lib/components/index.js +1034 -135
- package/lib/components/system/SystemBackgroundTasksTable.js +14 -10
- package/lib/components/system/SystemCassandraForm.js +98 -0
- package/lib/components/system/SystemElasticSearchForm.js +98 -0
- package/lib/components/system/SystemFilestoreForm.js +36 -28
- package/lib/components/system/SystemForm.js +19 -16
- package/lib/components/system/SystemIngressForm.js +85 -36
- package/lib/components/system/SystemSecurityForm.js +17 -14
- package/lib/components/system/SystemSmtpForm.js +13 -13
- package/lib/components/system/SystemTaskAdapterForm.js +49 -21
- package/lib/components/system/SystemTrustedCertificateForm.js +40 -0
- package/lib/components/system/SystemTrustedCertificatesTable.js +74 -0
- package/lib/components/system/SystemUserForm.js +15 -14
- package/lib/components/system/helpers.js +281 -98
- package/lib/components/system/helpers.test.js +16 -12
- package/lib/components/system/spaces/SystemSpaceForm.js +25 -24
- package/lib/components/system/spaces/SystemTenantForm.js +112 -68
- package/lib/components/system/spaces/SystemTenantTable.js +12 -8
- package/lib/components/table/Table.js +295 -227
- package/lib/components/table/Table.redux.js +339 -355
- package/lib/components/table/Table.redux.test.js +49 -47
- package/lib/components/table/Table.test.js +146 -132
- package/lib/components/table/defaults/BodyCell.js +12 -6
- package/lib/components/table/defaults/BodyRow.js +10 -4
- package/lib/components/table/defaults/BooleanFilter.js +17 -11
- package/lib/components/table/defaults/ColumnControl.js +26 -0
- package/lib/components/table/defaults/EmptyBodyRow.js +12 -6
- package/lib/components/table/defaults/FilterLayout.js +17 -11
- package/lib/components/table/defaults/Footer.js +11 -5
- package/lib/components/table/defaults/FooterCell.js +10 -4
- package/lib/components/table/defaults/FooterRow.js +10 -4
- package/lib/components/table/defaults/Header.js +10 -4
- package/lib/components/table/defaults/HeaderCell.js +16 -10
- package/lib/components/table/defaults/HeaderRow.js +10 -4
- package/lib/components/table/defaults/PaginationControl.js +18 -9
- package/lib/components/table/defaults/TableBody.js +10 -4
- package/lib/components/table/defaults/TableLayout.js +12 -6
- package/lib/components/table/defaults/TextFilter.js +16 -10
- package/lib/components/table/defaults/index.js +43 -33
- package/lib/components/task/builder/Connector.js +100 -111
- package/lib/components/task/builder/ConnectorForm.js +17 -11
- package/lib/components/task/builder/Node.js +101 -83
- package/lib/components/task/builder/NodeForm.js +30 -27
- package/lib/components/task/builder/NodeParametersForm.js +27 -24
- package/lib/components/task/builder/SvgCanvas.js +67 -96
- package/lib/components/task/builder/SvgText.js +19 -134
- package/lib/components/task/builder/TaskDefinitionConfigForm.js +27 -22
- package/lib/components/task/builder/TreeBuilder.js +140 -115
- package/lib/components/task/builder/builder.redux.js +311 -326
- package/lib/components/task/builder/constants.js +94 -45
- package/lib/components/task/builder/helpers.js +184 -173
- package/lib/components/task/builder/helpers.test.js +20 -18
- package/lib/components/task/builder/models.js +121 -98
- package/lib/components/task/category/TaskCategoryForm.js +31 -29
- package/lib/components/task/category/TaskCategoryTable.js +12 -8
- package/lib/components/task/common/UsageTable.js +16 -12
- package/lib/components/task/engine/EngineSettingsForm.js +13 -11
- package/lib/components/task/errors/RunErrorTable.js +50 -27
- package/lib/components/task/errors/SystemErrorsTable.js +13 -9
- package/lib/components/task/handlers/HandlerForm.js +55 -55
- package/lib/components/task/handlers/HandlerTable.js +35 -19
- package/lib/components/task/handlers/MissingHandlerTable.js +12 -8
- package/lib/components/task/policy_rule/PolicyRuleForm.js +33 -32
- package/lib/components/task/policy_rule/PolicyRuleTable.js +12 -8
- package/lib/components/task/runs/CreateManualTriggerForm.js +17 -15
- package/lib/components/task/runs/RunTable.js +45 -29
- package/lib/components/task/runs/RunTaskTable.js +10 -6
- package/lib/components/task/sources/SourceForm.js +47 -47
- package/lib/components/task/sources/SourceTable.js +29 -18
- package/lib/components/task/triggers/TriggerTable.js +71 -41
- package/lib/components/task/workflows/LinkedWorkflowForm.js +48 -54
- package/lib/components/task/workflows/LinkedWorkflowTable.js +46 -26
- package/lib/components/task/workflows/MissingRoutineTable.js +12 -8
- package/lib/components/task/workflows/WorkflowForm.js +49 -44
- package/lib/components/task/workflows/WorkflowTable.js +47 -29
- package/lib/helpers/SearchBuilder.js +73 -127
- package/lib/helpers/SearchBuilder.test.js +184 -175
- package/lib/helpers/index.js +116 -74
- package/lib/index.js +87 -38
- package/lib/reducer.js +11 -3
- package/lib/saga.js +42 -38
- package/lib/store.js +59 -35
- package/package.json +17 -29
- package/proxyhelper.js +122 -57
- package/assets/discussions/images/avi_128.png +0 -0
- package/assets/discussions/images/excel_128.png +0 -0
- package/assets/discussions/images/html_128.png +0 -0
- package/assets/discussions/images/illustrator_128.png +0 -0
- package/assets/discussions/images/indesign_128.png +0 -0
- package/assets/discussions/images/movie_128.png +0 -0
- package/assets/discussions/images/mpeg_128.png +0 -0
- package/assets/discussions/images/pdf_128.png +0 -0
- package/assets/discussions/images/photoshop_128.png +0 -0
- package/assets/discussions/images/powerpoint_128.png +0 -0
- package/assets/discussions/images/txt_128.png +0 -0
- package/assets/discussions/images/unknown_128.png +0 -0
- package/assets/discussions/images/word_128.png +0 -0
- package/assets/discussions/styles/_discussion.scss +0 -506
- package/lib/apis/discussions/index.js +0 -395
- package/lib/apis/socket/index.js +0 -77
- package/lib/apis/socket/socket.js +0 -350
- package/lib/apis/socket/socket.test.js +0 -90
- package/lib/apis/socket/timer.js +0 -45
- package/lib/apis/socket/timer.test.js +0 -51
- package/lib/apis/socket/topic.js +0 -185
- package/lib/apis/topics/index.js +0 -19
- package/lib/components/discussions/ChatInputForm.js +0 -424
- package/lib/components/discussions/DateBanner.js +0 -10
- package/lib/components/discussions/Discussion.js +0 -202
- package/lib/components/discussions/DiscussionForm.js +0 -227
- package/lib/components/discussions/InvitationForm.js +0 -107
- package/lib/components/discussions/MessageHistory.js +0 -110
- package/lib/components/discussions/MessagesByDate.js +0 -40
- package/lib/components/discussions/MessagesList.js +0 -30
- package/lib/components/discussions/MoreMessagesBanner.js +0 -26
- package/lib/components/discussions/ScrollHelper.js +0 -84
- package/lib/components/discussions/SystemMessage.js +0 -88
- package/lib/components/discussions/SystemMessageGroup.js +0 -15
- package/lib/components/discussions/UserMessage.js +0 -163
- package/lib/components/discussions/UserMessageGroup.js +0 -34
- package/lib/components/discussions/redux.js +0 -178
- package/lib/components/discussions/sagas.js +0 -500
- package/lib/helpers/discussions/canManage.js +0 -30
- package/lib/helpers/discussions/canManage.test.js +0 -69
- package/lib/helpers/discussions/generateSystemMessageContent.js +0 -131
- package/lib/helpers/discussions/generateSystemMessageContent.test.js +0 -450
- package/lib/models/discussions.js +0 -76
- package/lib/models/index.js +0 -1
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _SearchBuilder = require("./SearchBuilder");
|
|
4
|
+
var _immutable = require("immutable");
|
|
3
5
|
describe('defineFilter', function () {
|
|
4
6
|
var person = {
|
|
5
7
|
firstName: 'Alex',
|
|
6
8
|
lastName: 'Zen'
|
|
7
9
|
};
|
|
8
10
|
test('equals', function () {
|
|
9
|
-
var fn = defineFilter().equals('firstName', 'name').end();
|
|
11
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('firstName', 'name').end();
|
|
10
12
|
expect(fn(person, {
|
|
11
13
|
name: 'Alex'
|
|
12
14
|
})).toBe(true);
|
|
@@ -21,17 +23,18 @@ describe('defineFilter', function () {
|
|
|
21
23
|
}, {
|
|
22
24
|
name: "\xE5af"
|
|
23
25
|
})).toBe(false);
|
|
24
|
-
expect(fn(person, fromJS({
|
|
26
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
25
27
|
name: 'Alex'
|
|
26
28
|
}))).toBe(true);
|
|
27
|
-
expect(fn(person, fromJS({
|
|
29
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
28
30
|
name: 'ALEX'
|
|
29
31
|
}))).toBe(false);
|
|
30
|
-
});
|
|
31
|
-
// as the `equals` without strict.
|
|
32
|
+
});
|
|
32
33
|
|
|
34
|
+
// With non-empty filter values and object values it should behave the same
|
|
35
|
+
// as the `equals` without strict.
|
|
33
36
|
test('equals strict', function () {
|
|
34
|
-
var fn = defineFilter().equals('firstName', 'name', true).end();
|
|
37
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('firstName', 'name', true).end();
|
|
35
38
|
expect(fn(person, {
|
|
36
39
|
name: 'Alex'
|
|
37
40
|
})).toBe(true);
|
|
@@ -48,7 +51,7 @@ describe('defineFilter', function () {
|
|
|
48
51
|
})).toBe(false);
|
|
49
52
|
});
|
|
50
53
|
test('equals coerces', function () {
|
|
51
|
-
var fn = defineFilter().equals('value', 'filterValue', true).end();
|
|
54
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('value', 'filterValue', true).end();
|
|
52
55
|
expect(fn({
|
|
53
56
|
value: 2
|
|
54
57
|
}, {
|
|
@@ -61,7 +64,7 @@ describe('defineFilter', function () {
|
|
|
61
64
|
})).toBe(true);
|
|
62
65
|
});
|
|
63
66
|
test('equals caseInsensitive', function () {
|
|
64
|
-
var fn = defineFilter(true).equals('firstName', 'name').end();
|
|
67
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).equals('firstName', 'name').end();
|
|
65
68
|
expect(fn(person, {
|
|
66
69
|
name: 'Alex'
|
|
67
70
|
})).toBe(true);
|
|
@@ -78,7 +81,7 @@ describe('defineFilter', function () {
|
|
|
78
81
|
})).toBe(true);
|
|
79
82
|
});
|
|
80
83
|
test('multiple equals', function () {
|
|
81
|
-
var fn = defineFilter().equals('firstName', 'fname').equals('lastName', 'lname').end();
|
|
84
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('firstName', 'fname').equals('lastName', 'lname').end();
|
|
82
85
|
expect(fn(person, {
|
|
83
86
|
fname: 'Alex',
|
|
84
87
|
lname: 'Zen'
|
|
@@ -89,7 +92,7 @@ describe('defineFilter', function () {
|
|
|
89
92
|
})).toBe(false);
|
|
90
93
|
});
|
|
91
94
|
test('startsWith', function () {
|
|
92
|
-
var fn = defineFilter().startsWith('firstName', 'name').end();
|
|
95
|
+
var fn = (0, _SearchBuilder.defineFilter)().startsWith('firstName', 'name').end();
|
|
93
96
|
expect(fn(person, {
|
|
94
97
|
name: 'Alex'
|
|
95
98
|
})).toBe(true);
|
|
@@ -102,15 +105,15 @@ describe('defineFilter', function () {
|
|
|
102
105
|
expect(fn(person, {
|
|
103
106
|
name: 'Alexa'
|
|
104
107
|
})).toBe(false);
|
|
105
|
-
expect(fn(person, fromJS({
|
|
108
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
106
109
|
name: 'Ale'
|
|
107
110
|
}))).toBe(true);
|
|
108
|
-
expect(fn(person, fromJS({
|
|
111
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
109
112
|
name: 'ALE'
|
|
110
113
|
}))).toBe(false);
|
|
111
114
|
});
|
|
112
115
|
test('startsWith caseInsensitive', function () {
|
|
113
|
-
var fn = defineFilter(true).startsWith('firstName', 'name').end();
|
|
116
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).startsWith('firstName', 'name').end();
|
|
114
117
|
expect(fn(person, {
|
|
115
118
|
name: 'Alex'
|
|
116
119
|
})).toBe(true);
|
|
@@ -125,7 +128,7 @@ describe('defineFilter', function () {
|
|
|
125
128
|
})).toBe(false);
|
|
126
129
|
});
|
|
127
130
|
test('in', function () {
|
|
128
|
-
var fn = defineFilter()["in"]('firstName', 'names').end();
|
|
131
|
+
var fn = (0, _SearchBuilder.defineFilter)()["in"]('firstName', 'names').end();
|
|
129
132
|
expect(fn(person, {
|
|
130
133
|
names: ['Alex', 'Sam']
|
|
131
134
|
})).toBe(true);
|
|
@@ -135,17 +138,18 @@ describe('defineFilter', function () {
|
|
|
135
138
|
expect(fn(person, {
|
|
136
139
|
names: ['Ale', 'Same']
|
|
137
140
|
})).toBe(false);
|
|
138
|
-
expect(fn(person, fromJS({
|
|
141
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
139
142
|
names: ['Alex', 'Sam']
|
|
140
143
|
}))).toBe(true);
|
|
141
|
-
expect(fn(person, fromJS({
|
|
144
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
142
145
|
names: ['ALEX', 'Same']
|
|
143
146
|
}))).toBe(false);
|
|
144
|
-
});
|
|
145
|
-
// as the `in` without strict.
|
|
147
|
+
});
|
|
146
148
|
|
|
149
|
+
// With non-empty filter values and object values it should behave the same
|
|
150
|
+
// as the `in` without strict.
|
|
147
151
|
test('in strict', function () {
|
|
148
|
-
var fn = defineFilter()["in"]('firstName', 'names', true).end();
|
|
152
|
+
var fn = (0, _SearchBuilder.defineFilter)()["in"]('firstName', 'names', true).end();
|
|
149
153
|
expect(fn(person, {
|
|
150
154
|
names: ['Alex', 'Sam']
|
|
151
155
|
})).toBe(true);
|
|
@@ -157,7 +161,7 @@ describe('defineFilter', function () {
|
|
|
157
161
|
})).toBe(false);
|
|
158
162
|
});
|
|
159
163
|
test('in coerces', function () {
|
|
160
|
-
var fn = defineFilter()["in"]('value', 'filterValue').end();
|
|
164
|
+
var fn = (0, _SearchBuilder.defineFilter)()["in"]('value', 'filterValue').end();
|
|
161
165
|
expect(fn({
|
|
162
166
|
value: 2
|
|
163
167
|
}, {
|
|
@@ -170,7 +174,7 @@ describe('defineFilter', function () {
|
|
|
170
174
|
})).toBe(true);
|
|
171
175
|
});
|
|
172
176
|
test('in caseInsensitive', function () {
|
|
173
|
-
var fn = defineFilter(true)["in"]('firstName', 'names').end();
|
|
177
|
+
var fn = (0, _SearchBuilder.defineFilter)(true)["in"]('firstName', 'names').end();
|
|
174
178
|
expect(fn(person, {
|
|
175
179
|
names: ['Alex', 'Sam']
|
|
176
180
|
})).toBe(true);
|
|
@@ -182,7 +186,7 @@ describe('defineFilter', function () {
|
|
|
182
186
|
})).toBe(false);
|
|
183
187
|
});
|
|
184
188
|
test('in invalid filter value type', function () {
|
|
185
|
-
var fn = defineFilter()["in"]('firstName', 'names').end();
|
|
189
|
+
var fn = (0, _SearchBuilder.defineFilter)()["in"]('firstName', 'names').end();
|
|
186
190
|
expect(function () {
|
|
187
191
|
fn(person, {
|
|
188
192
|
names: 'Invalid'
|
|
@@ -195,11 +199,11 @@ describe('defineFilter', function () {
|
|
|
195
199
|
}).toThrowErrorMatchingInlineSnapshot("\"Invalid filter value for in operation of names filter. Got \\\"\\\". Require an array.\"");
|
|
196
200
|
});
|
|
197
201
|
test('greaterThan', function () {
|
|
198
|
-
var fn = defineFilter().greaterThan('firstName', 'min').end();
|
|
202
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThan('firstName', 'min').end();
|
|
199
203
|
expect(fn(person, {
|
|
200
204
|
min: 'Aa'
|
|
201
|
-
})).toBe(true);
|
|
202
|
-
|
|
205
|
+
})).toBe(true);
|
|
206
|
+
// "aa" > "Alex"
|
|
203
207
|
expect(fn(person, {
|
|
204
208
|
min: 'aa'
|
|
205
209
|
})).toBe(false);
|
|
@@ -209,21 +213,22 @@ describe('defineFilter', function () {
|
|
|
209
213
|
expect(fn(person, {
|
|
210
214
|
min: 'Az'
|
|
211
215
|
})).toBe(false);
|
|
212
|
-
expect(fn(person, fromJS({
|
|
216
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
213
217
|
min: 'Aa'
|
|
214
218
|
}))).toBe(true);
|
|
215
|
-
expect(fn(person, fromJS({
|
|
219
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
216
220
|
min: 'aa'
|
|
217
221
|
}))).toBe(false);
|
|
218
|
-
});
|
|
219
|
-
// as the `greaterThan` without strict.
|
|
222
|
+
});
|
|
220
223
|
|
|
224
|
+
// With non-empty filter values and object values it should behave the same
|
|
225
|
+
// as the `greaterThan` without strict.
|
|
221
226
|
test('greaterThan strict', function () {
|
|
222
|
-
var fn = defineFilter().greaterThan('firstName', 'min', true).end();
|
|
227
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThan('firstName', 'min', true).end();
|
|
223
228
|
expect(fn(person, {
|
|
224
229
|
min: 'Aa'
|
|
225
|
-
})).toBe(true);
|
|
226
|
-
|
|
230
|
+
})).toBe(true);
|
|
231
|
+
// "aa" > "Alex"
|
|
227
232
|
expect(fn(person, {
|
|
228
233
|
min: 'aa'
|
|
229
234
|
})).toBe(false);
|
|
@@ -235,7 +240,7 @@ describe('defineFilter', function () {
|
|
|
235
240
|
})).toBe(false);
|
|
236
241
|
});
|
|
237
242
|
test('greaterThan coerces', function () {
|
|
238
|
-
var fn = defineFilter().greaterThan('value', 'filterValue').end();
|
|
243
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThan('value', 'filterValue').end();
|
|
239
244
|
expect(fn({
|
|
240
245
|
value: 2
|
|
241
246
|
}, {
|
|
@@ -258,11 +263,11 @@ describe('defineFilter', function () {
|
|
|
258
263
|
})).toBe(false);
|
|
259
264
|
});
|
|
260
265
|
test('greaterThan caseInsensitive', function () {
|
|
261
|
-
var fn = defineFilter(true).greaterThan('firstName', 'min').end();
|
|
266
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).greaterThan('firstName', 'min').end();
|
|
262
267
|
expect(fn(person, {
|
|
263
268
|
min: 'Aa'
|
|
264
|
-
})).toBe(true);
|
|
265
|
-
|
|
269
|
+
})).toBe(true);
|
|
270
|
+
// "aa" > "Alex" but "alex" > "aa"
|
|
266
271
|
expect(fn(person, {
|
|
267
272
|
min: 'aa'
|
|
268
273
|
})).toBe(true);
|
|
@@ -274,11 +279,11 @@ describe('defineFilter', function () {
|
|
|
274
279
|
})).toBe(false);
|
|
275
280
|
});
|
|
276
281
|
test('greaterThanOrEquals', function () {
|
|
277
|
-
var fn = defineFilter().greaterThanOrEquals('firstName', 'min').end();
|
|
282
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThanOrEquals('firstName', 'min').end();
|
|
278
283
|
expect(fn(person, {
|
|
279
284
|
min: 'Aa'
|
|
280
|
-
})).toBe(true);
|
|
281
|
-
|
|
285
|
+
})).toBe(true);
|
|
286
|
+
// "aa" > "Alex"
|
|
282
287
|
expect(fn(person, {
|
|
283
288
|
min: 'aa'
|
|
284
289
|
})).toBe(false);
|
|
@@ -291,21 +296,22 @@ describe('defineFilter', function () {
|
|
|
291
296
|
expect(fn(person, {
|
|
292
297
|
min: 'Az'
|
|
293
298
|
})).toBe(false);
|
|
294
|
-
expect(fn(person, fromJS({
|
|
299
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
295
300
|
min: 'Aa'
|
|
296
301
|
}))).toBe(true);
|
|
297
|
-
expect(fn(person, fromJS({
|
|
302
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
298
303
|
min: 'aa'
|
|
299
304
|
}))).toBe(false);
|
|
300
|
-
});
|
|
301
|
-
// as the `greaterThanOrEquals` without strict.
|
|
305
|
+
});
|
|
302
306
|
|
|
307
|
+
// With non-empty filter values and object values it should behave the same
|
|
308
|
+
// as the `greaterThanOrEquals` without strict.
|
|
303
309
|
test('greaterThanOrEquals strict', function () {
|
|
304
|
-
var fn = defineFilter().greaterThanOrEquals('firstName', 'min', true).end();
|
|
310
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThanOrEquals('firstName', 'min', true).end();
|
|
305
311
|
expect(fn(person, {
|
|
306
312
|
min: 'Aa'
|
|
307
|
-
})).toBe(true);
|
|
308
|
-
|
|
313
|
+
})).toBe(true);
|
|
314
|
+
// "aa" > "Alex"
|
|
309
315
|
expect(fn(person, {
|
|
310
316
|
min: 'aa'
|
|
311
317
|
})).toBe(false);
|
|
@@ -320,7 +326,7 @@ describe('defineFilter', function () {
|
|
|
320
326
|
})).toBe(false);
|
|
321
327
|
});
|
|
322
328
|
test('greaterThanOrEquals coerces', function () {
|
|
323
|
-
var fn = defineFilter().greaterThanOrEquals('value', 'filterValue').end();
|
|
329
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThanOrEquals('value', 'filterValue').end();
|
|
324
330
|
expect(fn({
|
|
325
331
|
value: 2
|
|
326
332
|
}, {
|
|
@@ -353,11 +359,11 @@ describe('defineFilter', function () {
|
|
|
353
359
|
})).toBe(false);
|
|
354
360
|
});
|
|
355
361
|
test('greaterThanOrEquals caseInsensitive', function () {
|
|
356
|
-
var fn = defineFilter(true).greaterThanOrEquals('firstName', 'min').end();
|
|
362
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).greaterThanOrEquals('firstName', 'min').end();
|
|
357
363
|
expect(fn(person, {
|
|
358
364
|
min: 'Aa'
|
|
359
|
-
})).toBe(true);
|
|
360
|
-
|
|
365
|
+
})).toBe(true);
|
|
366
|
+
// "aa" > "Alex" but "alex" > "aa"
|
|
361
367
|
expect(fn(person, {
|
|
362
368
|
min: 'aa'
|
|
363
369
|
})).toBe(true);
|
|
@@ -372,11 +378,11 @@ describe('defineFilter', function () {
|
|
|
372
378
|
})).toBe(false);
|
|
373
379
|
});
|
|
374
380
|
test('lessThan', function () {
|
|
375
|
-
var fn = defineFilter().lessThan('firstName', 'max').end();
|
|
381
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThan('firstName', 'max').end();
|
|
376
382
|
expect(fn(person, {
|
|
377
383
|
max: 'Az'
|
|
378
|
-
})).toBe(true);
|
|
379
|
-
|
|
384
|
+
})).toBe(true);
|
|
385
|
+
// "AZ" < "Alex"
|
|
380
386
|
expect(fn(person, {
|
|
381
387
|
max: 'AZ'
|
|
382
388
|
})).toBe(false);
|
|
@@ -386,21 +392,22 @@ describe('defineFilter', function () {
|
|
|
386
392
|
expect(fn(person, {
|
|
387
393
|
max: 'Aa'
|
|
388
394
|
})).toBe(false);
|
|
389
|
-
expect(fn(person, fromJS({
|
|
395
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
390
396
|
max: 'Az'
|
|
391
397
|
}))).toBe(true);
|
|
392
|
-
expect(fn(person, fromJS({
|
|
398
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
393
399
|
max: 'AZ'
|
|
394
400
|
}))).toBe(false);
|
|
395
|
-
});
|
|
396
|
-
// as the `lessThan` without strict.
|
|
401
|
+
});
|
|
397
402
|
|
|
403
|
+
// With non-empty filter values and object values it should behave the same
|
|
404
|
+
// as the `lessThan` without strict.
|
|
398
405
|
test('lessThan strict', function () {
|
|
399
|
-
var fn = defineFilter().lessThan('firstName', 'max', true).end();
|
|
406
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThan('firstName', 'max', true).end();
|
|
400
407
|
expect(fn(person, {
|
|
401
408
|
max: 'Az'
|
|
402
|
-
})).toBe(true);
|
|
403
|
-
|
|
409
|
+
})).toBe(true);
|
|
410
|
+
// "AZ" < "Alex"
|
|
404
411
|
expect(fn(person, {
|
|
405
412
|
max: 'AZ'
|
|
406
413
|
})).toBe(false);
|
|
@@ -412,7 +419,7 @@ describe('defineFilter', function () {
|
|
|
412
419
|
})).toBe(false);
|
|
413
420
|
});
|
|
414
421
|
test('lessThan coerces', function () {
|
|
415
|
-
var fn = defineFilter().lessThan('value', 'filterValue').end();
|
|
422
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThan('value', 'filterValue').end();
|
|
416
423
|
expect(fn({
|
|
417
424
|
value: 2
|
|
418
425
|
}, {
|
|
@@ -445,11 +452,11 @@ describe('defineFilter', function () {
|
|
|
445
452
|
})).toBe(true);
|
|
446
453
|
});
|
|
447
454
|
test('lessThan caseInsensitive', function () {
|
|
448
|
-
var fn = defineFilter(true).lessThan('firstName', 'max').end();
|
|
455
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).lessThan('firstName', 'max').end();
|
|
449
456
|
expect(fn(person, {
|
|
450
457
|
max: 'Az'
|
|
451
|
-
})).toBe(true);
|
|
452
|
-
|
|
458
|
+
})).toBe(true);
|
|
459
|
+
// "AZ" < "Alex"
|
|
453
460
|
expect(fn(person, {
|
|
454
461
|
max: 'AZ'
|
|
455
462
|
})).toBe(true);
|
|
@@ -461,11 +468,11 @@ describe('defineFilter', function () {
|
|
|
461
468
|
})).toBe(false);
|
|
462
469
|
});
|
|
463
470
|
test('lessThanOrEquals', function () {
|
|
464
|
-
var fn = defineFilter().lessThanOrEquals('firstName', 'max').end();
|
|
471
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThanOrEquals('firstName', 'max').end();
|
|
465
472
|
expect(fn(person, {
|
|
466
473
|
max: 'Az'
|
|
467
|
-
})).toBe(true);
|
|
468
|
-
|
|
474
|
+
})).toBe(true);
|
|
475
|
+
// "aa" > "Alex"
|
|
469
476
|
expect(fn(person, {
|
|
470
477
|
max: 'aa'
|
|
471
478
|
})).toBe(true);
|
|
@@ -475,21 +482,22 @@ describe('defineFilter', function () {
|
|
|
475
482
|
expect(fn(person, {
|
|
476
483
|
max: 'Aa'
|
|
477
484
|
})).toBe(false);
|
|
478
|
-
expect(fn(person, fromJS({
|
|
485
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
479
486
|
max: 'Alex'
|
|
480
487
|
}))).toBe(true);
|
|
481
|
-
expect(fn(person, fromJS({
|
|
488
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
482
489
|
max: 'Aa'
|
|
483
490
|
}))).toBe(false);
|
|
484
|
-
});
|
|
485
|
-
// as the `lessThanOrEquals` without strict.
|
|
491
|
+
});
|
|
486
492
|
|
|
493
|
+
// With non-empty filter values and object values it should behave the same
|
|
494
|
+
// as the `lessThanOrEquals` without strict.
|
|
487
495
|
test('lessThanOrEquals strict', function () {
|
|
488
|
-
var fn = defineFilter().lessThanOrEquals('firstName', 'max', true).end();
|
|
496
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThanOrEquals('firstName', 'max', true).end();
|
|
489
497
|
expect(fn(person, {
|
|
490
498
|
max: 'Az'
|
|
491
|
-
})).toBe(true);
|
|
492
|
-
|
|
499
|
+
})).toBe(true);
|
|
500
|
+
// "aa" > "Alex"
|
|
493
501
|
expect(fn(person, {
|
|
494
502
|
max: 'aa'
|
|
495
503
|
})).toBe(true);
|
|
@@ -501,7 +509,7 @@ describe('defineFilter', function () {
|
|
|
501
509
|
})).toBe(false);
|
|
502
510
|
});
|
|
503
511
|
test('lessThanOrEquals coerces', function () {
|
|
504
|
-
var fn = defineFilter().lessThanOrEquals('value', 'filterValue').end();
|
|
512
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThanOrEquals('value', 'filterValue').end();
|
|
505
513
|
expect(fn({
|
|
506
514
|
value: 2
|
|
507
515
|
}, {
|
|
@@ -534,11 +542,11 @@ describe('defineFilter', function () {
|
|
|
534
542
|
})).toBe(true);
|
|
535
543
|
});
|
|
536
544
|
test('lessThanOrEquals caseInsensitive', function () {
|
|
537
|
-
var fn = defineFilter(true).lessThanOrEquals('firstName', 'max').end();
|
|
545
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).lessThanOrEquals('firstName', 'max').end();
|
|
538
546
|
expect(fn(person, {
|
|
539
547
|
max: 'Az'
|
|
540
|
-
})).toBe(true);
|
|
541
|
-
|
|
548
|
+
})).toBe(true);
|
|
549
|
+
// "aa" < "alex"
|
|
542
550
|
expect(fn(person, {
|
|
543
551
|
max: 'aa'
|
|
544
552
|
})).toBe(false);
|
|
@@ -550,22 +558,22 @@ describe('defineFilter', function () {
|
|
|
550
558
|
})).toBe(false);
|
|
551
559
|
});
|
|
552
560
|
test('between', function () {
|
|
553
|
-
var fn = defineFilter().between('firstName', 'min', 'max').end();
|
|
561
|
+
var fn = (0, _SearchBuilder.defineFilter)().between('firstName', 'min', 'max').end();
|
|
554
562
|
expect(fn(person, {
|
|
555
563
|
min: 'Aa',
|
|
556
564
|
max: 'Az'
|
|
557
|
-
})).toBe(true);
|
|
558
|
-
|
|
565
|
+
})).toBe(true);
|
|
566
|
+
// min inclusive
|
|
559
567
|
expect(fn(person, {
|
|
560
568
|
min: 'Alex',
|
|
561
569
|
max: 'Az'
|
|
562
|
-
})).toBe(true);
|
|
563
|
-
|
|
570
|
+
})).toBe(true);
|
|
571
|
+
// max exclusive
|
|
564
572
|
expect(fn(person, {
|
|
565
573
|
min: 'Aa',
|
|
566
574
|
max: 'Alex'
|
|
567
|
-
})).toBe(false);
|
|
568
|
-
|
|
575
|
+
})).toBe(false);
|
|
576
|
+
// case sensitive
|
|
569
577
|
expect(fn(person, {
|
|
570
578
|
min: 'aa',
|
|
571
579
|
max: 'az'
|
|
@@ -573,40 +581,41 @@ describe('defineFilter', function () {
|
|
|
573
581
|
expect(fn(person, {
|
|
574
582
|
min: 'Aa',
|
|
575
583
|
max: 'Ab'
|
|
576
|
-
})).toBe(false);
|
|
577
|
-
|
|
584
|
+
})).toBe(false);
|
|
585
|
+
// tests a min - max range that relies on case sensitivity
|
|
578
586
|
expect(fn(person, {
|
|
579
587
|
min: 'A',
|
|
580
588
|
max: 'a'
|
|
581
589
|
})).toBe(true);
|
|
582
|
-
expect(fn(person, fromJS({
|
|
590
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
583
591
|
min: 'Aa',
|
|
584
592
|
max: 'Az'
|
|
585
593
|
}))).toBe(true);
|
|
586
|
-
expect(fn(person, fromJS({
|
|
594
|
+
expect(fn(person, (0, _immutable.fromJS)({
|
|
587
595
|
min: 'Aa',
|
|
588
596
|
max: 'Alex'
|
|
589
597
|
}))).toBe(false);
|
|
590
|
-
});
|
|
591
|
-
// as the `between` without strict.
|
|
598
|
+
});
|
|
592
599
|
|
|
600
|
+
// With non-empty filter values and object values it should behave the same
|
|
601
|
+
// as the `between` without strict.
|
|
593
602
|
test('between', function () {
|
|
594
|
-
var fn = defineFilter().between('firstName', 'min', 'max', true).end();
|
|
603
|
+
var fn = (0, _SearchBuilder.defineFilter)().between('firstName', 'min', 'max', true).end();
|
|
595
604
|
expect(fn(person, {
|
|
596
605
|
min: 'Aa',
|
|
597
606
|
max: 'Az'
|
|
598
|
-
})).toBe(true);
|
|
599
|
-
|
|
607
|
+
})).toBe(true);
|
|
608
|
+
// min inclusive
|
|
600
609
|
expect(fn(person, {
|
|
601
610
|
min: 'Alex',
|
|
602
611
|
max: 'Az'
|
|
603
|
-
})).toBe(true);
|
|
604
|
-
|
|
612
|
+
})).toBe(true);
|
|
613
|
+
// max exclusive
|
|
605
614
|
expect(fn(person, {
|
|
606
615
|
min: 'Aa',
|
|
607
616
|
max: 'Alex'
|
|
608
|
-
})).toBe(false);
|
|
609
|
-
|
|
617
|
+
})).toBe(false);
|
|
618
|
+
// case sensitive
|
|
610
619
|
expect(fn(person, {
|
|
611
620
|
min: 'aa',
|
|
612
621
|
max: 'az'
|
|
@@ -617,7 +626,7 @@ describe('defineFilter', function () {
|
|
|
617
626
|
})).toBe(false);
|
|
618
627
|
});
|
|
619
628
|
test('between coerces', function () {
|
|
620
|
-
var fn = defineFilter().between('value', 'min', 'max').end();
|
|
629
|
+
var fn = (0, _SearchBuilder.defineFilter)().between('value', 'min', 'max').end();
|
|
621
630
|
expect(fn({
|
|
622
631
|
value: 1
|
|
623
632
|
}, {
|
|
@@ -658,7 +667,7 @@ describe('defineFilter', function () {
|
|
|
658
667
|
}).toThrowErrorMatchingInlineSnapshot("\"Invalid filter values for between operation of min and max. Min \\\"3\\\" not less than max \\\"1\\\"\"");
|
|
659
668
|
});
|
|
660
669
|
test('between caseInsensitive', function () {
|
|
661
|
-
var fn = defineFilter(true).between('firstName', 'min', 'max').end();
|
|
670
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).between('firstName', 'min', 'max').end();
|
|
662
671
|
expect(fn(person, {
|
|
663
672
|
min: 'Aa',
|
|
664
673
|
max: 'Az'
|
|
@@ -679,7 +688,7 @@ describe('defineFilter', function () {
|
|
|
679
688
|
}).toThrowErrorMatchingInlineSnapshot("\"Invalid filter values for between operation of min and max. Min \\\"A\\\" not less than max \\\"a\\\" (caseInsensitive)\"");
|
|
680
689
|
});
|
|
681
690
|
test('between invalid', function () {
|
|
682
|
-
var fn = defineFilter(true).between('firstName', 'min', 'max').end();
|
|
691
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).between('firstName', 'min', 'max').end();
|
|
683
692
|
expect(function () {
|
|
684
693
|
fn(person, {
|
|
685
694
|
min: 'z',
|
|
@@ -694,7 +703,7 @@ describe('defineFilter', function () {
|
|
|
694
703
|
}).toThrowErrorMatchingInlineSnapshot("\"Invalid filter values for between operation of min and max. Min \\\"a\\\" not less than max \\\"a\\\" (caseInsensitive)\"");
|
|
695
704
|
});
|
|
696
705
|
test('or', function () {
|
|
697
|
-
var fn = defineFilter(false, 'or').equals('firstName', 'name1').equals('firstName', 'name2').end();
|
|
706
|
+
var fn = (0, _SearchBuilder.defineFilter)(false, 'or').equals('firstName', 'name1').equals('firstName', 'name2').end();
|
|
698
707
|
expect(fn(person, {
|
|
699
708
|
name1: 'Alex',
|
|
700
709
|
name2: 'Other'
|
|
@@ -709,7 +718,7 @@ describe('defineFilter', function () {
|
|
|
709
718
|
})).toBe(false);
|
|
710
719
|
});
|
|
711
720
|
test('nested ands / ors', function () {
|
|
712
|
-
var fn = defineFilter().equals('lastName', 'lname').or().equals('firstName', 'name1').equals('firstName', 'name2').end().end();
|
|
721
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('lastName', 'lname').or().equals('firstName', 'name1').equals('firstName', 'name2').end().end();
|
|
713
722
|
expect(fn(person, {
|
|
714
723
|
name1: 'Alex',
|
|
715
724
|
name2: 'Other',
|
|
@@ -727,7 +736,7 @@ describe('defineFilter', function () {
|
|
|
727
736
|
})).toBe(false);
|
|
728
737
|
});
|
|
729
738
|
test('nested ands / ors caseInsensitive', function () {
|
|
730
|
-
var fn = defineFilter(true).equals('lastName', 'lname').or().equals('firstName', 'name1').equals('firstName', 'name2').end().end();
|
|
739
|
+
var fn = (0, _SearchBuilder.defineFilter)(true).equals('lastName', 'lname').or().equals('firstName', 'name1').equals('firstName', 'name2').end().end();
|
|
731
740
|
expect(fn(person, {
|
|
732
741
|
name1: 'alex',
|
|
733
742
|
name2: 'Other',
|
|
@@ -766,9 +775,9 @@ describe('defineFilter', function () {
|
|
|
766
775
|
names: null
|
|
767
776
|
};
|
|
768
777
|
test('equals', function () {
|
|
769
|
-
var fn = defineFilter().equals('firstName', 'name').end();
|
|
778
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('firstName', 'name').end();
|
|
779
|
+
// No matter the object value, when the filter value is
|
|
770
780
|
// undefined, null, or empty the filter is ignored.
|
|
771
|
-
|
|
772
781
|
expect(fn(person, undefinedFilter)).toBe(true);
|
|
773
782
|
expect(fn(emptyPerson, undefinedFilter)).toBe(true);
|
|
774
783
|
expect(fn(nullPerson, undefinedFilter)).toBe(true);
|
|
@@ -780,8 +789,8 @@ describe('defineFilter', function () {
|
|
|
780
789
|
expect(fn(person, emptyFilter)).toBe(true);
|
|
781
790
|
expect(fn(emptyPerson, emptyFilter)).toBe(true);
|
|
782
791
|
expect(fn(nullPerson, emptyFilter)).toBe(true);
|
|
783
|
-
expect(fn(undefinedPerson, emptyFilter)).toBe(true);
|
|
784
|
-
|
|
792
|
+
expect(fn(undefinedPerson, emptyFilter)).toBe(true);
|
|
793
|
+
// Filtering '', null, undefined by 'a' should result in false.
|
|
785
794
|
expect(fn(emptyPerson, {
|
|
786
795
|
name: 'a'
|
|
787
796
|
})).toBe(false);
|
|
@@ -793,7 +802,7 @@ describe('defineFilter', function () {
|
|
|
793
802
|
})).toBe(false);
|
|
794
803
|
});
|
|
795
804
|
test('equals strict', function () {
|
|
796
|
-
var fn = defineFilter().equals('firstName', 'name', true).end();
|
|
805
|
+
var fn = (0, _SearchBuilder.defineFilter)().equals('firstName', 'name', true).end();
|
|
797
806
|
expect(fn(person, undefinedFilter)).toBe(false);
|
|
798
807
|
expect(fn(person, nullFilter)).toBe(false);
|
|
799
808
|
expect(fn(person, emptyFilter)).toBe(false);
|
|
@@ -802,9 +811,9 @@ describe('defineFilter', function () {
|
|
|
802
811
|
expect(fn(emptyPerson, emptyFilter)).toBe(true);
|
|
803
812
|
});
|
|
804
813
|
test('in', function () {
|
|
805
|
-
var fn = defineFilter()["in"]('firstName', 'names').end();
|
|
814
|
+
var fn = (0, _SearchBuilder.defineFilter)()["in"]('firstName', 'names').end();
|
|
815
|
+
// No matter the object value, when the filter value is undefined, null,
|
|
806
816
|
// or empty array the filter is ignored
|
|
807
|
-
|
|
808
817
|
expect(fn(person, emptyInFilter)).toBe(true);
|
|
809
818
|
expect(fn(person, nullInFilter)).toBe(true);
|
|
810
819
|
expect(fn(person, undefinedFilter)).toBe(true);
|
|
@@ -816,9 +825,9 @@ describe('defineFilter', function () {
|
|
|
816
825
|
expect(fn(nullPerson, undefinedFilter)).toBe(true);
|
|
817
826
|
expect(fn(undefinedPerson, emptyInFilter)).toBe(true);
|
|
818
827
|
expect(fn(undefinedPerson, nullInFilter)).toBe(true);
|
|
819
|
-
expect(fn(undefinedPerson, undefinedFilter)).toBe(true);
|
|
828
|
+
expect(fn(undefinedPerson, undefinedFilter)).toBe(true);
|
|
829
|
+
// If the filter value array contains "", null, undefined then the object
|
|
820
830
|
// matches if its value for that field is "", null, undefined respectively
|
|
821
|
-
|
|
822
831
|
expect(fn(person, {
|
|
823
832
|
names: ['']
|
|
824
833
|
})).toBe(false);
|
|
@@ -836,8 +845,8 @@ describe('defineFilter', function () {
|
|
|
836
845
|
})).toBe(false);
|
|
837
846
|
expect(fn(undefinedPerson, {
|
|
838
847
|
names: [undefined]
|
|
839
|
-
})).toBe(true);
|
|
840
|
-
|
|
848
|
+
})).toBe(true);
|
|
849
|
+
// Filtering '', null, undefined by ['a'] should result in false.
|
|
841
850
|
expect(fn(emptyPerson, {
|
|
842
851
|
names: ['a']
|
|
843
852
|
})).toBe(false);
|
|
@@ -849,9 +858,9 @@ describe('defineFilter', function () {
|
|
|
849
858
|
})).toBe(false);
|
|
850
859
|
});
|
|
851
860
|
test('in strict', function () {
|
|
852
|
-
var fn = defineFilter()["in"]('firstName', 'names', true).end();
|
|
861
|
+
var fn = (0, _SearchBuilder.defineFilter)()["in"]('firstName', 'names', true).end();
|
|
862
|
+
// When strict and given [], null, undefined nothing can be a member of
|
|
853
863
|
// those empty sets so false should always be returned.
|
|
854
|
-
|
|
855
864
|
expect(fn(person, emptyInFilter)).toBe(false);
|
|
856
865
|
expect(fn(person, nullInFilter)).toBe(false);
|
|
857
866
|
expect(fn(person, undefinedFilter)).toBe(false);
|
|
@@ -866,7 +875,7 @@ describe('defineFilter', function () {
|
|
|
866
875
|
expect(fn(undefinedPerson, undefinedFilter)).toBe(false);
|
|
867
876
|
});
|
|
868
877
|
test('startsWith', function () {
|
|
869
|
-
var fn = defineFilter().startsWith('firstName', 'name').end();
|
|
878
|
+
var fn = (0, _SearchBuilder.defineFilter)().startsWith('firstName', 'name').end();
|
|
870
879
|
expect(fn(person, {})).toBe(true);
|
|
871
880
|
expect(fn(person, {
|
|
872
881
|
name: ''
|
|
@@ -894,8 +903,8 @@ describe('defineFilter', function () {
|
|
|
894
903
|
})).toBe(true);
|
|
895
904
|
expect(fn(undefinedPerson, {
|
|
896
905
|
name: null
|
|
897
|
-
})).toBe(true);
|
|
898
|
-
|
|
906
|
+
})).toBe(true);
|
|
907
|
+
// Filtering '', null, undefined by startsWith 'a' should result in false.
|
|
899
908
|
expect(fn(emptyPerson, {
|
|
900
909
|
name: 'a'
|
|
901
910
|
})).toBe(false);
|
|
@@ -907,9 +916,9 @@ describe('defineFilter', function () {
|
|
|
907
916
|
})).toBe(false);
|
|
908
917
|
});
|
|
909
918
|
test('greaterThan', function () {
|
|
910
|
-
var fn = defineFilter().greaterThan('firstName', 'min').end();
|
|
919
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThan('firstName', 'min').end();
|
|
920
|
+
// No matter the object value, when the filter value is undefined, null,
|
|
911
921
|
// or empty array the filter is ignored
|
|
912
|
-
|
|
913
922
|
expect(fn(person, {})).toBe(true);
|
|
914
923
|
expect(fn(person, {
|
|
915
924
|
min: ''
|
|
@@ -937,8 +946,8 @@ describe('defineFilter', function () {
|
|
|
937
946
|
})).toBe(true);
|
|
938
947
|
expect(fn(undefinedPerson, {
|
|
939
948
|
min: null
|
|
940
|
-
})).toBe(true);
|
|
941
|
-
|
|
949
|
+
})).toBe(true);
|
|
950
|
+
// 'A' > '' > null > undefined
|
|
942
951
|
expect(fn(undefinedPerson, {
|
|
943
952
|
min: 'A'
|
|
944
953
|
})).toBe(false);
|
|
@@ -950,8 +959,8 @@ describe('defineFilter', function () {
|
|
|
950
959
|
})).toBe(false);
|
|
951
960
|
});
|
|
952
961
|
test('greaterThan strict', function () {
|
|
953
|
-
var fn = defineFilter().greaterThan('firstName', 'min', true).end();
|
|
954
|
-
|
|
962
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThan('firstName', 'min', true).end();
|
|
963
|
+
// 'A' > '' > null > undefined
|
|
955
964
|
expect(fn(undefinedPerson, {})).toBe(false);
|
|
956
965
|
expect(fn(nullPerson, {})).toBe(true);
|
|
957
966
|
expect(fn(nullPerson, {
|
|
@@ -973,9 +982,9 @@ describe('defineFilter', function () {
|
|
|
973
982
|
})).toBe(true);
|
|
974
983
|
});
|
|
975
984
|
test('greaterThanOrEquals', function () {
|
|
976
|
-
var fn = defineFilter().greaterThanOrEquals('firstName', 'min').end();
|
|
985
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThanOrEquals('firstName', 'min').end();
|
|
986
|
+
// No matter the object value, when the filter value is undefined, null,
|
|
977
987
|
// or empty array the filter is ignored
|
|
978
|
-
|
|
979
988
|
expect(fn(person, {})).toBe(true);
|
|
980
989
|
expect(fn(person, {
|
|
981
990
|
min: ''
|
|
@@ -1003,8 +1012,8 @@ describe('defineFilter', function () {
|
|
|
1003
1012
|
})).toBe(true);
|
|
1004
1013
|
expect(fn(undefinedPerson, {
|
|
1005
1014
|
min: null
|
|
1006
|
-
})).toBe(true);
|
|
1007
|
-
|
|
1015
|
+
})).toBe(true);
|
|
1016
|
+
// 'A' > '' > null > undefined
|
|
1008
1017
|
expect(fn(undefinedPerson, {
|
|
1009
1018
|
min: 'A'
|
|
1010
1019
|
})).toBe(false);
|
|
@@ -1016,8 +1025,8 @@ describe('defineFilter', function () {
|
|
|
1016
1025
|
})).toBe(false);
|
|
1017
1026
|
});
|
|
1018
1027
|
test('greaterThanOrEquals strict', function () {
|
|
1019
|
-
var fn = defineFilter().greaterThanOrEquals('firstName', 'min', true).end();
|
|
1020
|
-
|
|
1028
|
+
var fn = (0, _SearchBuilder.defineFilter)().greaterThanOrEquals('firstName', 'min', true).end();
|
|
1029
|
+
// 'A' > '' > null > undefined
|
|
1021
1030
|
expect(fn(undefinedPerson, {})).toBe(true);
|
|
1022
1031
|
expect(fn(undefinedPerson, {
|
|
1023
1032
|
min: null
|
|
@@ -1048,9 +1057,9 @@ describe('defineFilter', function () {
|
|
|
1048
1057
|
})).toBe(true);
|
|
1049
1058
|
});
|
|
1050
1059
|
test('lessThan', function () {
|
|
1051
|
-
var fn = defineFilter().lessThan('firstName', 'max').end();
|
|
1060
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThan('firstName', 'max').end();
|
|
1061
|
+
// No matter the object value, when the filter value is undefined, null,
|
|
1052
1062
|
// or empty array the filter is ignored
|
|
1053
|
-
|
|
1054
1063
|
expect(fn(person, {})).toBe(true);
|
|
1055
1064
|
expect(fn(person, {
|
|
1056
1065
|
max: ''
|
|
@@ -1078,8 +1087,8 @@ describe('defineFilter', function () {
|
|
|
1078
1087
|
})).toBe(true);
|
|
1079
1088
|
expect(fn(undefinedPerson, {
|
|
1080
1089
|
max: null
|
|
1081
|
-
})).toBe(true);
|
|
1082
|
-
|
|
1090
|
+
})).toBe(true);
|
|
1091
|
+
// 'A' > '' > null > undefined
|
|
1083
1092
|
expect(fn(undefinedPerson, {
|
|
1084
1093
|
max: 'A'
|
|
1085
1094
|
})).toBe(true);
|
|
@@ -1091,8 +1100,8 @@ describe('defineFilter', function () {
|
|
|
1091
1100
|
})).toBe(true);
|
|
1092
1101
|
});
|
|
1093
1102
|
test('lessThan strict', function () {
|
|
1094
|
-
var fn = defineFilter().lessThan('firstName', 'max', true).end();
|
|
1095
|
-
|
|
1103
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThan('firstName', 'max', true).end();
|
|
1104
|
+
// 'A' > '' > null > undefined
|
|
1096
1105
|
expect(fn(undefinedPerson, {})).toBe(false);
|
|
1097
1106
|
expect(fn(undefinedPerson, {
|
|
1098
1107
|
max: null
|
|
@@ -1123,9 +1132,9 @@ describe('defineFilter', function () {
|
|
|
1123
1132
|
})).toBe(false);
|
|
1124
1133
|
});
|
|
1125
1134
|
test('lessThanOrEquals', function () {
|
|
1126
|
-
var fn = defineFilter().lessThanOrEquals('firstName', 'max').end();
|
|
1135
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThanOrEquals('firstName', 'max').end();
|
|
1136
|
+
// No matter the object value, when the filter value is undefined, null,
|
|
1127
1137
|
// or empty array the filter is ignored
|
|
1128
|
-
|
|
1129
1138
|
expect(fn(person, {})).toBe(true);
|
|
1130
1139
|
expect(fn(person, {
|
|
1131
1140
|
max: ''
|
|
@@ -1153,8 +1162,8 @@ describe('defineFilter', function () {
|
|
|
1153
1162
|
})).toBe(true);
|
|
1154
1163
|
expect(fn(undefinedPerson, {
|
|
1155
1164
|
max: null
|
|
1156
|
-
})).toBe(true);
|
|
1157
|
-
|
|
1165
|
+
})).toBe(true);
|
|
1166
|
+
// 'A' > '' > null > undefined
|
|
1158
1167
|
expect(fn(undefinedPerson, {
|
|
1159
1168
|
max: 'A'
|
|
1160
1169
|
})).toBe(true);
|
|
@@ -1166,8 +1175,8 @@ describe('defineFilter', function () {
|
|
|
1166
1175
|
})).toBe(true);
|
|
1167
1176
|
});
|
|
1168
1177
|
test('lessThanOrEquals strict', function () {
|
|
1169
|
-
var fn = defineFilter().lessThanOrEquals('firstName', 'max', true).end();
|
|
1170
|
-
|
|
1178
|
+
var fn = (0, _SearchBuilder.defineFilter)().lessThanOrEquals('firstName', 'max', true).end();
|
|
1179
|
+
// 'A' > '' > null > undefined
|
|
1171
1180
|
expect(fn(undefinedPerson, {})).toBe(true);
|
|
1172
1181
|
expect(fn(undefinedPerson, {
|
|
1173
1182
|
max: null
|
|
@@ -1198,7 +1207,7 @@ describe('defineFilter', function () {
|
|
|
1198
1207
|
})).toBe(false);
|
|
1199
1208
|
});
|
|
1200
1209
|
test('between', function () {
|
|
1201
|
-
var fn = defineFilter().between('firstName', 'min', 'max').end();
|
|
1210
|
+
var fn = (0, _SearchBuilder.defineFilter)().between('firstName', 'min', 'max').end();
|
|
1202
1211
|
expect(fn(person, {})).toBe(true);
|
|
1203
1212
|
expect(fn(person, {
|
|
1204
1213
|
min: '',
|
|
@@ -1266,8 +1275,8 @@ describe('defineFilter', function () {
|
|
|
1266
1275
|
expect(fn(undefinedPerson, {
|
|
1267
1276
|
min: 'A',
|
|
1268
1277
|
max: null
|
|
1269
|
-
})).toBe(true);
|
|
1270
|
-
|
|
1278
|
+
})).toBe(true);
|
|
1279
|
+
// 'A' > '' > null > undefined
|
|
1271
1280
|
expect(fn(undefinedPerson, {
|
|
1272
1281
|
min: 'A',
|
|
1273
1282
|
max: 'z'
|
|
@@ -1282,8 +1291,8 @@ describe('defineFilter', function () {
|
|
|
1282
1291
|
})).toBe(false);
|
|
1283
1292
|
});
|
|
1284
1293
|
test('between strict', function () {
|
|
1285
|
-
var fn = defineFilter().between('firstName', 'min', 'max', true).end();
|
|
1286
|
-
|
|
1294
|
+
var fn = (0, _SearchBuilder.defineFilter)().between('firstName', 'min', 'max', true).end();
|
|
1295
|
+
// 'Alex' > 'A'
|
|
1287
1296
|
expect(fn(person, {
|
|
1288
1297
|
min: undefined,
|
|
1289
1298
|
max: 'A'
|
|
@@ -1342,7 +1351,7 @@ describe('defineFilter', function () {
|
|
|
1342
1351
|
})).toBe(true);
|
|
1343
1352
|
});
|
|
1344
1353
|
test('between strict invalid', function () {
|
|
1345
|
-
var fn = defineFilter().between('firstName', 'min', 'max', true).end();
|
|
1354
|
+
var fn = (0, _SearchBuilder.defineFilter)().between('firstName', 'min', 'max', true).end();
|
|
1346
1355
|
expect(function () {
|
|
1347
1356
|
fn(person, {
|
|
1348
1357
|
min: 'a',
|
|
@@ -1395,118 +1404,118 @@ describe('defineKqlQuery', function () {
|
|
|
1395
1404
|
};
|
|
1396
1405
|
});
|
|
1397
1406
|
test('empty expression', function () {
|
|
1398
|
-
var query = defineKqlQuery().equals('empty', 'empty').equals('nullName', 'nullName').equals('undefinedName', 'undefinedName').end();
|
|
1407
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('empty', 'empty').equals('nullName', 'nullName').equals('undefinedName', 'undefinedName').end();
|
|
1399
1408
|
expect(query).toBeDefined();
|
|
1400
1409
|
expect(query(values)).toBe('');
|
|
1401
1410
|
});
|
|
1402
1411
|
test('empty root expression', function () {
|
|
1403
|
-
var query = defineKqlQuery().equals('empty', 'empty').or().equals('slug', 'slug').equals('nullName', 'nullName').equals('undefinedName', 'undefinedName').end().end();
|
|
1412
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('empty', 'empty').or().equals('slug', 'slug').equals('nullName', 'nullName').equals('undefinedName', 'undefinedName').end().end();
|
|
1404
1413
|
expect(query).toBeDefined();
|
|
1405
1414
|
expect(query(values)).toBe('( slug = "acme" )');
|
|
1406
1415
|
});
|
|
1407
1416
|
test('empty expression stack', function () {
|
|
1408
|
-
var query = defineKqlQuery().equals('slug', 'slug').equals('empty', 'empty').equals('nullName', 'nullName').equals('undefinedName', 'undefinedName').end();
|
|
1417
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('slug', 'slug').equals('empty', 'empty').equals('nullName', 'nullName').equals('undefinedName', 'undefinedName').end();
|
|
1409
1418
|
expect(query).toBeDefined();
|
|
1410
1419
|
expect(query(values)).toBe('slug = "acme"');
|
|
1411
1420
|
});
|
|
1412
1421
|
test('equals', function () {
|
|
1413
|
-
var query = defineKqlQuery().equals('name', 'name').equals('slug', 'slug').equals('empty', 'empty').end();
|
|
1422
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('name', 'name').equals('slug', 'slug').equals('empty', 'empty').end();
|
|
1414
1423
|
expect(query).toBeDefined();
|
|
1415
1424
|
expect(query(values)).toBe("name = \"Matt\" AND slug = \"acme\"");
|
|
1416
1425
|
});
|
|
1417
1426
|
test('equals strict', function () {
|
|
1418
|
-
var query = defineKqlQuery().equals('empty', 'empty', true).equals('nullName', 'nullName', true).equals('undefinedName', 'undefinedName', true).end();
|
|
1427
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('empty', 'empty', true).equals('nullName', 'nullName', true).equals('undefinedName', 'undefinedName', true).end();
|
|
1419
1428
|
expect(query).toBeDefined();
|
|
1420
1429
|
expect(query(values)).toBe("empty = \"\" AND nullName = \"\" AND undefinedName = \"\"");
|
|
1421
1430
|
});
|
|
1422
1431
|
test('startsWith', function () {
|
|
1423
|
-
var query = defineKqlQuery().startsWith('name', 'name').startsWith('slug', 'slug').startsWith('empty', 'empty').startsWith('nullName', 'nullName').startsWith('undefinedName', 'undefinedName').end();
|
|
1432
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().startsWith('name', 'name').startsWith('slug', 'slug').startsWith('empty', 'empty').startsWith('nullName', 'nullName').startsWith('undefinedName', 'undefinedName').end();
|
|
1424
1433
|
expect(query).toBeDefined();
|
|
1425
1434
|
expect(query(values)).toBe("name =* \"Matt\" AND slug =* \"acme\"");
|
|
1426
1435
|
});
|
|
1427
1436
|
test('in', function () {
|
|
1428
|
-
var query = defineKqlQuery()["in"]('name', 'names').end();
|
|
1437
|
+
var query = (0, _SearchBuilder.defineKqlQuery)()["in"]('name', 'names').end();
|
|
1429
1438
|
expect(query).toBeDefined();
|
|
1430
1439
|
expect(query(values)).toBe("name IN (\"Bob\", \"Matt\")");
|
|
1431
1440
|
});
|
|
1432
1441
|
test('in strict', function () {
|
|
1433
|
-
var query = defineKqlQuery()["in"]('name', 'names', true).end();
|
|
1442
|
+
var query = (0, _SearchBuilder.defineKqlQuery)()["in"]('name', 'names', true).end();
|
|
1434
1443
|
expect(query).toBeDefined();
|
|
1435
1444
|
expect(query(values)).toBe("name IN (\"Bob\", \"Matt\", \"\", \"\", \"\")");
|
|
1436
1445
|
});
|
|
1437
1446
|
test('in invalid list', function () {
|
|
1438
|
-
var query = defineKqlQuery()["in"]('name', 'names')["in"]('name', 'emptyNames')["in"]('name', 'nullNames')["in"]('name', 'undefinedNames').end();
|
|
1447
|
+
var query = (0, _SearchBuilder.defineKqlQuery)()["in"]('name', 'names')["in"]('name', 'emptyNames')["in"]('name', 'nullNames')["in"]('name', 'undefinedNames').end();
|
|
1439
1448
|
expect(query).toBeDefined();
|
|
1440
1449
|
expect(query(values)).toBe("name IN (\"Bob\", \"Matt\")");
|
|
1441
1450
|
});
|
|
1442
1451
|
test('between', function () {
|
|
1443
|
-
var query = defineKqlQuery().between('values', 'minValue', 'maxValue').between('missingOne', 'missingValue', 'maxValue').between('missingBoth', 'missingValue', 'missingValue').end();
|
|
1452
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().between('values', 'minValue', 'maxValue').between('missingOne', 'missingValue', 'maxValue').between('missingBoth', 'missingValue', 'missingValue').end();
|
|
1444
1453
|
expect(query).toBeDefined();
|
|
1445
1454
|
expect(query(values)).toBe("values BETWEEN (\"min\", \"max\")");
|
|
1446
1455
|
});
|
|
1447
1456
|
test('between strict', function () {
|
|
1448
|
-
var query = defineKqlQuery().between('values', 'minValue', 'maxValue', true).between('missingOne', 'missingValue', 'maxValue', true).between('missingBoth', 'missingValue', 'missingValue', true).end();
|
|
1457
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().between('values', 'minValue', 'maxValue', true).between('missingOne', 'missingValue', 'maxValue', true).between('missingBoth', 'missingValue', 'missingValue', true).end();
|
|
1449
1458
|
expect(query).toBeDefined();
|
|
1450
1459
|
expect(query(values)).toBe("values BETWEEN (\"min\", \"max\") AND missingOne BETWEEN (\"\", \"max\") AND missingBoth BETWEEN (\"\", \"\")");
|
|
1451
1460
|
});
|
|
1452
1461
|
test('greaterThan', function () {
|
|
1453
|
-
var query = defineKqlQuery().greaterThan('name', 'name').greaterThan('slug', 'slug').greaterThan('empty', 'empty').end();
|
|
1462
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().greaterThan('name', 'name').greaterThan('slug', 'slug').greaterThan('empty', 'empty').end();
|
|
1454
1463
|
expect(query).toBeDefined();
|
|
1455
1464
|
expect(query(values)).toBe("name > \"Matt\" AND slug > \"acme\"");
|
|
1456
1465
|
});
|
|
1457
1466
|
test('greaterThan strict', function () {
|
|
1458
|
-
var query = defineKqlQuery().greaterThan('empty', 'empty', true).greaterThan('nullName', 'nullName', true).greaterThan('undefinedName', 'undefinedName', true).end();
|
|
1467
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().greaterThan('empty', 'empty', true).greaterThan('nullName', 'nullName', true).greaterThan('undefinedName', 'undefinedName', true).end();
|
|
1459
1468
|
expect(query).toBeDefined();
|
|
1460
1469
|
expect(query(values)).toBe("empty > \"\" AND nullName > \"\" AND undefinedName > \"\"");
|
|
1461
1470
|
});
|
|
1462
1471
|
test('greaterThanOrEquals', function () {
|
|
1463
|
-
var query = defineKqlQuery().greaterThanOrEquals('name', 'name').greaterThanOrEquals('slug', 'slug').greaterThanOrEquals('empty', 'empty').end();
|
|
1472
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().greaterThanOrEquals('name', 'name').greaterThanOrEquals('slug', 'slug').greaterThanOrEquals('empty', 'empty').end();
|
|
1464
1473
|
expect(query).toBeDefined();
|
|
1465
1474
|
expect(query(values)).toBe("name >= \"Matt\" AND slug >= \"acme\"");
|
|
1466
1475
|
});
|
|
1467
1476
|
test('greaterThanOrEquals strict', function () {
|
|
1468
|
-
var query = defineKqlQuery().greaterThanOrEquals('empty', 'empty', true).greaterThanOrEquals('nullName', 'nullName', true).greaterThanOrEquals('undefinedName', 'undefinedName', true).end();
|
|
1477
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().greaterThanOrEquals('empty', 'empty', true).greaterThanOrEquals('nullName', 'nullName', true).greaterThanOrEquals('undefinedName', 'undefinedName', true).end();
|
|
1469
1478
|
expect(query).toBeDefined();
|
|
1470
1479
|
expect(query(values)).toBe("empty >= \"\" AND nullName >= \"\" AND undefinedName >= \"\"");
|
|
1471
1480
|
});
|
|
1472
1481
|
test('lessThan', function () {
|
|
1473
|
-
var query = defineKqlQuery().lessThan('name', 'name').lessThan('slug', 'slug').lessThan('empty', 'empty').end();
|
|
1482
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().lessThan('name', 'name').lessThan('slug', 'slug').lessThan('empty', 'empty').end();
|
|
1474
1483
|
expect(query).toBeDefined();
|
|
1475
1484
|
expect(query(values)).toBe("name < \"Matt\" AND slug < \"acme\"");
|
|
1476
1485
|
});
|
|
1477
1486
|
test('lessThan strict', function () {
|
|
1478
|
-
var query = defineKqlQuery().lessThan('empty', 'empty', true).lessThan('nullName', 'nullName', true).lessThan('undefinedName', 'undefinedName', true).end();
|
|
1487
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().lessThan('empty', 'empty', true).lessThan('nullName', 'nullName', true).lessThan('undefinedName', 'undefinedName', true).end();
|
|
1479
1488
|
expect(query).toBeDefined();
|
|
1480
1489
|
expect(query(values)).toBe("empty < \"\" AND nullName < \"\" AND undefinedName < \"\"");
|
|
1481
1490
|
});
|
|
1482
1491
|
test('lessThanOrEquals', function () {
|
|
1483
|
-
var query = defineKqlQuery().lessThanOrEquals('name', 'name').lessThanOrEquals('slug', 'slug').lessThanOrEquals('empty', 'empty').end();
|
|
1492
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().lessThanOrEquals('name', 'name').lessThanOrEquals('slug', 'slug').lessThanOrEquals('empty', 'empty').end();
|
|
1484
1493
|
expect(query).toBeDefined();
|
|
1485
1494
|
expect(query(values)).toBe("name <= \"Matt\" AND slug <= \"acme\"");
|
|
1486
1495
|
});
|
|
1487
1496
|
test('lessThanOrEquals strict', function () {
|
|
1488
|
-
var query = defineKqlQuery().lessThanOrEquals('empty', 'empty', true).lessThanOrEquals('nullName', 'nullName', true).lessThanOrEquals('undefinedName', 'undefinedName', true).end();
|
|
1497
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().lessThanOrEquals('empty', 'empty', true).lessThanOrEquals('nullName', 'nullName', true).lessThanOrEquals('undefinedName', 'undefinedName', true).end();
|
|
1489
1498
|
expect(query).toBeDefined();
|
|
1490
1499
|
expect(query(values)).toBe("empty <= \"\" AND nullName <= \"\" AND undefinedName <= \"\"");
|
|
1491
1500
|
});
|
|
1492
1501
|
describe('groupings', function () {
|
|
1493
1502
|
test('or separates equalities in its context with OR', function () {
|
|
1494
|
-
var query = defineKqlQuery().or().equals('name', 'name').equals('name', 'otherName').end().end();
|
|
1503
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().or().equals('name', 'name').equals('name', 'otherName').end().end();
|
|
1495
1504
|
expect(query).toBeDefined();
|
|
1496
1505
|
expect(query(values)).toEqual('( name = "Matt" OR name = "Bob" )');
|
|
1497
1506
|
});
|
|
1498
1507
|
test('or following other equalities implies an and', function () {
|
|
1499
|
-
var query = defineKqlQuery().equals('slug', 'slug').or().equals('name', 'name').equals('name', 'otherName').end().end();
|
|
1508
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('slug', 'slug').or().equals('name', 'name').equals('name', 'otherName').end().end();
|
|
1500
1509
|
expect(query).toBeDefined();
|
|
1501
1510
|
expect(query(values)).toEqual('slug = "acme" AND ( name = "Matt" OR name = "Bob" )');
|
|
1502
1511
|
});
|
|
1503
1512
|
test('complex query', function () {
|
|
1504
|
-
var query = defineKqlQuery().equals('slug', 'slug').or().equals('name', 'name').and().equals('name', 'otherName').equals('slug', 'slug').end().end().end();
|
|
1513
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('slug', 'slug').or().equals('name', 'name').and().equals('name', 'otherName').equals('slug', 'slug').end().end().end();
|
|
1505
1514
|
expect(query).toBeDefined();
|
|
1506
1515
|
expect(query(values)).toEqual('slug = "acme" AND ( name = "Matt" OR ( name = "Bob" AND slug = "acme" ) )');
|
|
1507
1516
|
});
|
|
1508
1517
|
test('when previous items are not included', function () {
|
|
1509
|
-
var query = defineKqlQuery().equals('name', 'missingName').equals('slug', 'slug').end();
|
|
1518
|
+
var query = (0, _SearchBuilder.defineKqlQuery)().equals('name', 'missingName').equals('slug', 'slug').end();
|
|
1510
1519
|
expect(query).toBeDefined();
|
|
1511
1520
|
expect(query(values)).toBe('slug = "acme"');
|
|
1512
1521
|
});
|