-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#1303): toml parser for scripts and tests
- Loading branch information
1 parent
5ba2c98
commit abb24c9
Showing
10 changed files
with
150 additions
and
9 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
14 changes: 14 additions & 0 deletions
14
packages/bruno-toml/tests/scripts/post-response/request.json
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,14 @@ | ||
{ | ||
"meta": { | ||
"name": "Get users", | ||
"type": "http", | ||
"seq": 1 | ||
}, | ||
"http": { | ||
"method": "GET", | ||
"url": "https://reqres.in/api/users" | ||
}, | ||
"script": { | ||
"res": "bru.setVar('token', res.body.token);\nconsole.log('token: ' + res.body.token);" | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
packages/bruno-toml/tests/scripts/post-response/request.toml
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,14 @@ | ||
[meta] | ||
name = 'Get users' | ||
type = 'http' | ||
seq = 1 | ||
|
||
[http] | ||
method = 'GET' | ||
url = 'https://reqres.in/api/users' | ||
|
||
[script] | ||
post-response = ''' | ||
bru.setVar('token', res.body.token); | ||
console.log('token: ' + res.body.token); | ||
''' |
14 changes: 14 additions & 0 deletions
14
packages/bruno-toml/tests/scripts/pre-request/request.json
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,14 @@ | ||
{ | ||
"meta": { | ||
"name": "Get users", | ||
"type": "http", | ||
"seq": 1 | ||
}, | ||
"http": { | ||
"method": "GET", | ||
"url": "https://reqres.in/api/users" | ||
}, | ||
"script": { | ||
"req": "req.body.id = uuid();" | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/bruno-toml/tests/scripts/pre-request/request.toml
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,13 @@ | ||
[meta] | ||
name = 'Get users' | ||
type = 'http' | ||
seq = 1 | ||
|
||
[http] | ||
method = 'GET' | ||
url = 'https://reqres.in/api/users' | ||
|
||
[script] | ||
pre-request = ''' | ||
req.body.id = uuid(); | ||
''' |
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,12 @@ | ||
{ | ||
"meta": { | ||
"name": "Get users", | ||
"type": "http", | ||
"seq": 1 | ||
}, | ||
"http": { | ||
"method": "GET", | ||
"url": "https://reqres.in/api/users" | ||
}, | ||
"tests": "test('Status code is 200', function () {\n expect(res.statusCode).to.eql(200);\n});" | ||
} |
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,15 @@ | ||
[meta] | ||
name = 'Get users' | ||
type = 'http' | ||
seq = 1 | ||
|
||
[http] | ||
method = 'GET' | ||
url = 'https://reqres.in/api/users' | ||
|
||
[script] | ||
tests = ''' | ||
test('Status code is 200', function () { | ||
expect(res.statusCode).to.eql(200); | ||
}); | ||
''' |