Skip to content

improve tests with a helper #46

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

Open
ccoVeille opened this issue Jun 27, 2024 · 0 comments
Open

improve tests with a helper #46

ccoVeille opened this issue Jun 27, 2024 · 0 comments

Comments

@ccoVeille
Copy link
Contributor

I suggested using this

Oh, I totally missed that, sorry, indeed.

maybe you could code a helper to reuse it, something simple, as any test framework would do.

but maybe something like this

err := doBatchedRequestsForCollection(tt.args.auth, tt.args.method, tt.args.url, tt.args.batchSize, tt.args.recordMap);
checkError(t, tt.wantErr, err, "doBatchedRequestsForCollection")
func checkError(t *testing.T, wantErr bool, err error, method string) {
    t.Helper()
   
    if wantErr && err != nil {
      return
    }

    if !wantErr && err == nil {
      return
    }

   t.Errorf("%s() error = %v, wantErr %v", method, err, tt.wantErr)
}

But as there is no errors, there might have no need

@k-capehart replied this

I'll have to look into that, thank you. It would have to be part of a different PR though. Feel free to open an Issue or Discussion post about it.

Originally posted by @k-capehart in #45 (comment)

So I'm opening an issue

@k-capehart k-capehart self-assigned this Jul 1, 2024
@k-capehart k-capehart removed their assignment Nov 2, 2024
@k-capehart k-capehart changed the title improve tests with an helper improve tests with a helper Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants