-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: included tests for utils package #40
base: main
Are you sure you want to change the base?
Conversation
- included tests for utils package Signed-off-by: naveensrinivasan <[email protected]>
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
if got := TemplateString(tt.args.templateMap, tt.args.s); got != tt.want { |
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.
Instead of manually rolling the checks, in other tests we use the require
function from testify
which simpliies this logic
withs: map[string]string{"test-input": "value1"}, | ||
}, | ||
want: []types.Action{ | ||
{TaskReference: "test-task", With: map[string]string{"test-input": "value1"}}, |
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.
I may be missing it, but where does the templating occur in this test (docs for reference)
t.Errorf("TemplateTaskActionsWithInputs() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
} | ||
if diff := cmp.Diff(tt.want, got, cmpopts.IgnoreFields(types.Action{}, "ZarfComponentAction")); diff != "" { |
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 another area where I think require
is a bit cleaner with less code; maybe you could compare just a single field in the Action instead of doing the deep inspection
Description
...
Related Issue
Fixes #
Relates to #
Type of change
Checklist before merging