-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core/models): ALL_VALUES_OF is not extracting values from main forms
- Loading branch information
Showing
2 changed files
with
37 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import {ALL_VALUES_OF, MainForm} from './expression-utils'; | ||
|
||
describe('ALL_VALUES_OF', () => { | ||
it('should get all values by key in dataset', () => { | ||
const result = ALL_VALUES_OF(forms, 'dog_name'); | ||
const dogs = 4; | ||
expect(result.length).toBe(dogs); | ||
for (let i = 1; i <= dogs; i++) { | ||
expect(result).toContain(`dog${i}`); | ||
} | ||
}); | ||
}); | ||
|
||
const forms: MainForm[] = [ | ||
{dog_name: 'dog1', reps: {'rep_1': [{dog_name: 'dog4'}]}}, | ||
{}, | ||
{dog_name: 'dog2'}, | ||
{dog_name: 'dog3'}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters