-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Only flatten payload to required depth, in order to preserve ch…
…ecklist answers
- Loading branch information
1 parent
3517778
commit ac9c112
Showing
4 changed files
with
18 additions
and
11 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
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 |
---|---|---|
|
@@ -3,10 +3,6 @@ import { TextInputType } from "@planx/components/TextInput/model"; | |
import { Schema } from "../../model"; | ||
import { Props } from "../../Public"; | ||
|
||
/** | ||
* Temp simple example to build out UI | ||
* Can be re-used as mock for testing | ||
*/ | ||
export const Zoo: Schema = { | ||
type: "Animal", | ||
fields: [ | ||
|
@@ -116,11 +112,13 @@ export const mockZooPayload = { | |
"mockFn.one.email.address": "[email protected]", | ||
"mockFn.one.name": "Richard Parker", | ||
"mockFn.one.size": "Medium", | ||
"mockFn.one.food": ["meat", "leaves", "bamboo"], | ||
"mockFn.two.age": 10, | ||
"mockFn.two.cuteness.amount": "Very", | ||
"mockFn.two.email.address": "[email protected]", | ||
"mockFn.two.name": "Richard Parker", | ||
"mockFn.two.size": "Medium", | ||
"mockFn.two.food": ["meat", "leaves", "bamboo"], | ||
"mockFn.total.listItems": 2, | ||
}, | ||
}; |
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 |
---|---|---|
|
@@ -15,28 +15,32 @@ describe("passport data shape", () => { | |
"email.address": "[email protected]", | ||
name: "Richard Parker", | ||
size: "Medium", | ||
food: ["bamboo", "leaves"], | ||
}, | ||
{ | ||
age: 10, | ||
"cuteness.amount": "Very", | ||
"email.address": "[email protected]", | ||
name: "Richard Parker", | ||
size: "Medium", | ||
food: ["meat", "bamboo", "leaves"], | ||
}, | ||
], | ||
}; | ||
|
||
expect(flatten(defaultPassportData)).toEqual({ | ||
expect(flatten(defaultPassportData, { depth: 2 })).toEqual({ | ||
"mockFn.one.age": 10, | ||
"mockFn.one.cuteness.amount": "Very", | ||
"mockFn.one.email.address": "[email protected]", | ||
"mockFn.one.name": "Richard Parker", | ||
"mockFn.one.size": "Medium", | ||
"mockFn.one.food": ["bamboo", "leaves"], | ||
"mockFn.two.age": 10, | ||
"mockFn.two.cuteness.amount": "Very", | ||
"mockFn.two.email.address": "[email protected]", | ||
"mockFn.two.name": "Richard Parker", | ||
"mockFn.two.size": "Medium", | ||
"mockFn.two.food": ["meat", "bamboo", "leaves"], | ||
}); | ||
}); | ||
|
||
|
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