-
-
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.
Merge pull request #10 from dyne/sf/improvements
Improvements (TM)
- Loading branch information
Showing
14 changed files
with
88 additions
and
37 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
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
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 |
---|---|---|
@@ -1,16 +1,25 @@ | ||
import { visit } from './visitor'; | ||
|
||
test('that', async () => { | ||
test('ast is correct', async () => { | ||
// Given I have a contract with filesystem statements in it | ||
const contract = `Rule unknown ignore | ||
Given I have a 'string' named 'stringToWrite' | ||
and I have a 'string' named 'nameOfTheFile' | ||
Then I save the 'stringToWrite' into the file 'nameOfTheFile' | ||
`; | ||
await visit(contract, { | ||
data: { stringToWrite: 'hello world', nameOfTheFile: 'hello-world.txt' }, | ||
}); | ||
|
||
expect(true).toStrictEqual(true); | ||
// When I generate ast of the contract | ||
const data = { | ||
stringToWrite: 'hello world', | ||
nameOfTheFile: 'hello-world.txt', | ||
}; | ||
const ast = await visit(contract, { data: data }); | ||
// Then the content must be "stringToWrite" | ||
expect(ast.content).toStrictEqual('stringToWrite'); | ||
// and the filename must be "nameOfTheFile" | ||
expect(ast.filename).toStrictEqual('nameOfTheFile'); | ||
// and the value indexed by the content in data must be "hello world" | ||
expect(data[ast.content as 'stringToWrite']).toStrictEqual('hello world'); | ||
// and the value indexed by the filename in data must be "hello-world.txt" | ||
expect(data[ast.filename as 'nameOfTheFile']).toStrictEqual('hello-world.txt'); | ||
}); |
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
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
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
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
packages: | ||
- 'pkg/*' | ||
- pkg/* |