Classifications often yield scalar results. Since those results are
used directly in the diff, we have the situation where the expected
diff format (an array) is not provided. Consistent with the rest of
the system, we should consider a scalar to affect every index.
* src/validate/ValidStateMonitor.js (_checkCauseFix): Consider scalar
diffs to affect every index when checking for fixes.
* test/validate/ValidStateMonitorTest.js: Add test.
See the description in the test case. This is a bug fix.
* src/validate/ValidStateMonitor.js
(_checkCauseFix): Do not consider an empty diff on a past failure to
be a fix.
* test/validate/ValidStateMonitorTest.js: Add test.
DEV-2296
ValidStateMonitor now uses a Store in place of the original primitive
object-based diff format. The original format is translated by
DataValidator. The code is in a transitional state, and considering
the amount of time we spend on various areas of this project, will
likely stay this way for a while.
* src/validate/DataValidator.js
(__construct): Accept Store factory parameter.
(_store_factory): Add field.
(_createStores): Add method.
(_validate): Handle Store.
(updateFailures): Add method.
(_populateStore): Add method.
* test/validate/DataValidatorTest.js: Add tests.
* src/validate/ValidStateMonitor.js
(update): Enforce Store diff.
Wait to process failures until fixes are calculated.
(_checkFailureFix): Handle asynchronous, Promise-based diff.
(_checkCauseFix): Extract logic from _checkCauseFix.
* test/validate/ValidStateMonitorTest.js:
Modify test cases to be Promise-based and handle async calls where
appropriate. That was a friggin' expensive mess.
DEV-2296
Stepping stone to async. fix checks.
* src/validate/ValidStateMonitor.js
(update, detectFixes, _checkFailureFix): Return Promise.
* test/validate/ValidStateMonitorTest.js: Update to use promises.
DEV-2296
* src/validate/ValidStateMonitor.js (mergeFailures):
Another error on a field that previously failed will no longer overwrite the
previous failure, which caused issue when the causes changed (leaving fields
potentially unfixed).
* test/validate/ValidStateMonitorTest.js: Respective tests added.
* src/validate/Failure.js (__construct): Takes an array of causes.
(getCauses): Now returns an array of causes.
* src/validate/ValidStateMonitor.js: Recognize fixes on array of causes.
* test/validate/FailureTest.js: Updated
* test/validate/ValidStateMonitorTest.js: Updated
This maintains BC with the old string-based system.
* src/validate/ValidStateMonitor.js (_getCause): Added.
(detectFixes): Consider failure cause if available when checking for fixes.
This is to facilitate a transition to Failure without a BC break.
* test/validate/ValidStateMonitorTest.js: Ensure that replacing messages
with Failure will continue to operate as expected.
The intent is to ultimately replace ClientFieldValidator with this and
individual validators that interact with it.
* src/validate/ValidStateMonitor.js: Added
* test/validate/ValidStateMonitorTest.js: Added