Skip to content

Commit

Permalink
Add a couple of tests for bundle init <custom dir>
Browse files Browse the repository at this point in the history
helpers - tests user_name helper with default local server
helpers-error - tests user_name helper if API response had error
  • Loading branch information
denik committed Feb 7, 2025
1 parent 65ac9a3 commit 797ff12
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
5 changes: 5 additions & 0 deletions acceptance/bundle/templates/helpers-error/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

>>> [CLI] bundle init .
Error: failed to compute file content for helpers.txt.tmpl. template: :1:14: executing "" at <user_name>: error calling user_name:

Exit code: 1
2 changes: 2 additions & 0 deletions acceptance/bundle/templates/helpers-error/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
errcode trace $CLI bundle init .
# test runner will complain if helpers.txt is found - it should not be there
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
user_name: {{ user_name }}
7 changes: 7 additions & 0 deletions acceptance/bundle/templates/helpers-error/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Badness = '''(minor) error message is not great: executing "" at <user_name>: error calling user_name:'''
LocalOnly = true

[[Server]]
Pattern = "GET /api/2.0/preview/scim/v2/Me"
Response.Body = '{}'
Response.StatusCode = 500
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
2 changes: 2 additions & 0 deletions acceptance/bundle/templates/helpers/output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
✨ Successfully initialized template
user_name: [USERNAME]
3 changes: 3 additions & 0 deletions acceptance/bundle/templates/helpers/script
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
$CLI bundle init .
cat helpers.txt
rm helpers.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
user_name: {{ user_name }}
1 change: 1 addition & 0 deletions acceptance/bundle/templates/helpers/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LocalOnly = true

0 comments on commit 797ff12

Please sign in to comment.