-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for pendo client. Signed-off-by: Alejandro Visiedo <[email protected]>
- Loading branch information
Showing
4 changed files
with
485 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
internal/test/builder/clients/pendo/builder_setmetadatadetailsrequest.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package pendo | ||
|
||
import ( | ||
"github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" | ||
pendo_api "github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" | ||
) | ||
|
||
type SetMetadataDetailsRequest interface { | ||
Build() *pendo.SetMetadataDetailsRequest | ||
SetVisitorID(value string) SetMetadataDetailsRequest | ||
AddValue(fieldName string, value any) SetMetadataDetailsRequest | ||
} | ||
|
||
type setMetadataDetailsRequest pendo_api.SetMetadataDetailsRequest | ||
|
||
func NewSetMetadataDetailsRequest() SetMetadataDetailsRequest { | ||
return (*setMetadataDetailsRequest)(&pendo_api.SetMetadataDetailsRequest{}) | ||
} | ||
|
||
func (b *setMetadataDetailsRequest) Build() *pendo.SetMetadataDetailsRequest { | ||
return (*pendo.SetMetadataDetailsRequest)(b) | ||
} | ||
|
||
func (b *setMetadataDetailsRequest) SetVisitorID(value string) SetMetadataDetailsRequest { | ||
b.VisitorID = value | ||
return b | ||
} | ||
|
||
func (b *setMetadataDetailsRequest) AddValue(fieldName string, value any) SetMetadataDetailsRequest { | ||
b.Values[fieldName] = value | ||
return b | ||
} |
26 changes: 26 additions & 0 deletions
26
internal/test/builder/clients/pendo/builder_setmetadatarequest.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package pendo | ||
|
||
import ( | ||
"github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" | ||
pendo_api "github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" | ||
) | ||
|
||
type SetMetadataRequest interface { | ||
Add(item pendo.SetMetadataDetailsRequest) SetMetadataRequest | ||
Build() *pendo.SetMetadataRequest | ||
} | ||
|
||
type setMetadataRequest pendo_api.SetMetadataRequest | ||
|
||
func NewSetMetadataRequest() SetMetadataRequest { | ||
return (*setMetadataRequest)(&pendo_api.SetMetadataRequest{}) | ||
} | ||
|
||
func (b *setMetadataRequest) Build() *pendo.SetMetadataRequest { | ||
return (*pendo.SetMetadataRequest)(b) | ||
} | ||
|
||
func (b *setMetadataRequest) Add(item pendo.SetMetadataDetailsRequest) SetMetadataRequest { | ||
*b = append(*b, item) | ||
return b | ||
} |
62 changes: 62 additions & 0 deletions
62
internal/test/builder/clients/pendo/builder_setmetadataresponse.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package pendo | ||
|
||
import ( | ||
"github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" | ||
pendo_api "github.com/podengo-project/idmsvc-backend/internal/interface/client/pendo" | ||
) | ||
|
||
type SetMetadataResponse interface { | ||
Build() *pendo.SetMetadataResponse | ||
WithTotal(value int64) SetMetadataResponse | ||
WithUpdated(value int64) SetMetadataResponse | ||
IncUpdated() SetMetadataResponse | ||
WithFailed(value int64) SetMetadataResponse | ||
IncFailed() SetMetadataResponse | ||
AddMissing(value string) SetMetadataResponse | ||
WithKind(value pendo.Kind) SetMetadataResponse | ||
} | ||
|
||
type setMetadataResponse pendo_api.SetMetadataResponse | ||
|
||
func NewSetMetadataResponse() SetMetadataResponse { | ||
return (*setMetadataResponse)(&pendo_api.SetMetadataResponse{}) | ||
} | ||
|
||
func (b *setMetadataResponse) Build() *pendo.SetMetadataResponse { | ||
return (*pendo.SetMetadataResponse)(b) | ||
} | ||
|
||
func (b *setMetadataResponse) WithTotal(value int64) SetMetadataResponse { | ||
b.Total = value | ||
return b | ||
} | ||
|
||
func (b *setMetadataResponse) WithUpdated(value int64) SetMetadataResponse { | ||
b.Updated = value | ||
return b | ||
} | ||
|
||
func (b *setMetadataResponse) IncUpdated() SetMetadataResponse { | ||
b.Updated++ | ||
return b | ||
} | ||
|
||
func (b *setMetadataResponse) WithFailed(value int64) SetMetadataResponse { | ||
b.Failed = value | ||
return b | ||
} | ||
|
||
func (b *setMetadataResponse) IncFailed() SetMetadataResponse { | ||
b.Failed++ | ||
return b | ||
} | ||
|
||
func (b *setMetadataResponse) AddMissing(value string) SetMetadataResponse { | ||
b.Missing = append(b.Missing, value) | ||
return b | ||
} | ||
|
||
func (b *setMetadataResponse) WithKind(value pendo.Kind) SetMetadataResponse { | ||
b.Kind = value | ||
return b | ||
} |
Oops, something went wrong.