New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: adjust DSL indentation in tests inside package server #1597
Conversation
@@ -46,14 +46,14 @@ func TestListObjectsDispatchCount(t *testing.T) { | |||
{ | |||
name: "test_direct_relation", | |||
model: `model | |||
schema 1.1 | |||
schema 1.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really nested - can you put the model
clause on a newline below and start everything inline from there. For example,
model: `
model
schema 1.1
type user
type document
relations
define viewer: [user]
`,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your feedback @jon-whit
I wrote a script for this. I'll adjust it to move the content after ` to be in a new line aligned at column 0
Here's a new example with the expected output
model := testutils.MustTransformDSLToProtoWithID(`
model
schema 1.1
type user
type document
relations
define viewer: [user, document#viewer] or editor
define editor: [user, document#viewer]`)
Once approved, I can take care of other packages by just re-running the script
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1597 +/- ##
==========================================
- Coverage 86.39% 86.34% -0.04%
==========================================
Files 86 86
Lines 8224 8224
==========================================
- Hits 7104 7100 -4
- Misses 789 792 +3
- Partials 331 332 +1 ☔ View full report in Codecov by Sentry. |
…into refactor-tests-dst-indentation
model: ` | ||
model | ||
schema 1.1 | ||
|
||
type user | ||
type user | ||
|
||
type folder | ||
relations | ||
define viewer: [user] | ||
`, | ||
type folder | ||
relations | ||
define viewer: [user] | ||
`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testutils.MustTransformDSLToProtoWithID(` | ||
model | ||
schema 1.1 | ||
type user | ||
|
||
type document | ||
relations | ||
define viewer: [user]`), nil) | ||
relations | ||
define viewer: [user]`), nil) | ||
|
||
mockDatastore.EXPECT(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: accidentally closed PR. I will resubmit respecting previous lines indentation. ETA today/tomorrow
Fixes #1302 for package server
Description
Now that openfga/language parser has better support for whitespaces, refactor to
have better readability in the test files.
References
Issue #1302
Review Checklist
main