-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(helpers): new object get attribute sentence
- Loading branch information
1 parent
8e48806
commit bd86e90
Showing
2 changed files
with
38 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Slangroom } from '@slangroom/core'; | ||
import { helpers } from '@slangroom/helpers'; | ||
import test from 'ava'; | ||
|
||
test('@slangroom/helpers 🎣 get path object', async (t) => { | ||
const setter = `Rule unknown ignore | ||
Given I send object 'the_object' and send path 'the_path' and manipulate and get and output into 'mimmo' | ||
Given I have a 'string' named 'mimmo' | ||
Then print 'mimmo' | ||
`; | ||
|
||
const slangroom = new Slangroom(helpers); | ||
const res = await slangroom.execute(setter, { | ||
data: { | ||
"the_object": { | ||
"a": "b", | ||
"c": { | ||
"d": "e" | ||
} | ||
}, | ||
"the_path": "c.d" | ||
}, | ||
}); | ||
t.deepEqual(res.result, { | ||
mimmo: 'e' | ||
}, res.logs) | ||
}); |