Skip to content

improve tests with a helper #46

@ccoVeille

Description

@ccoVeille

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions