Skip to content

Commit

Permalink
enum fixes, PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbloss committed Jan 3, 2025
1 parent 5f428ca commit d12cc57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 17 deletions.
16 changes: 6 additions & 10 deletions check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ var (
Value: ol.RefOf("Requests"),
}

equalsEnum = ol.PredicateTypeEnumEquals
predicateUpdateInput = &ol.PredicateUpdateInput{
Type: &equalsEnum,
Type: &ol.PredicateTypeEnumEquals,
Value: ol.RefOf("Requests"),
}

Expand Down Expand Up @@ -1082,7 +1081,7 @@ func TestCanUpdateFilterToNull(t *testing.T) {
func TestCanUpdateNotesToNull(t *testing.T) {
// Arrange
testRequest := BuildUpdateRequest("CustomEvent", map[string]any{
"notes": nil,
"notes": "",
})
client := BestTestClient(t, "check/can_update_notes_to_null", testRequest)
// Act
Expand All @@ -1092,7 +1091,7 @@ func TestCanUpdateNotesToNull(t *testing.T) {
CategoryId: ol.RefOf(id),
Enabled: ol.RefOf(true),
LevelId: ol.RefOf(id),
Notes: ol.NewNull(),
Notes: ol.RefOf(""),
})
// Assert
autopilot.Equals(t, nil, err)
Expand Down Expand Up @@ -1170,9 +1169,6 @@ func TestJsonUnmarshalCreateCheckManual(t *testing.T) {
// Act
buf1, err1 := ol.UnmarshalCheckCreateInput(ol.CheckTypeManual, []byte(data))
// Assert
stuff := buf1.(*ol.CheckManualCreateInput)
stuff2 := &output
fmt.Println(stuff2, stuff)
autopilot.Ok(t, err1)
autopilot.Equals(t, &output, buf1.(*ol.CheckManualCreateInput))
}
Expand All @@ -1197,13 +1193,13 @@ func TestJsonUnmarshalCreateCheckToolUsage(t *testing.T) {
output := ol.CheckToolUsageCreateInput{
Name: "Example",
Notes: ol.RefOf("Example Notes"),
EnvironmentPredicate: &ol.PredicateInput{Type: ol.PredicateTypeEnum("exists")},
EnvironmentPredicate: &ol.PredicateInput{Type: ol.PredicateTypeEnumExists},
ToolNamePredicate: &ol.PredicateInput{
Type: ol.PredicateTypeEnum("contains"),
Type: ol.PredicateTypeEnumContains,
Value: ol.RefOf("go"),
},
ToolUrlPredicate: &ol.PredicateInput{
Type: ol.PredicateTypeEnum("starts_with"),
Type: ol.PredicateTypeEnumStartsWith,
Value: ol.RefOf("https"),
},
}
Expand Down
6 changes: 3 additions & 3 deletions scalar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func TestNewIdentifierArray(t *testing.T) {
}

func TestNewNullString(t *testing.T) {
buf, err := json.Marshal(ol.NewNull())
buf, err := json.Marshal(ol.NewNull[string]())
if err != nil {
t.Errorf("got unexpected error: '%+v'", err)
}
Expand All @@ -242,12 +242,12 @@ func TestNewNullableWithValueString(t *testing.T) {
testCases := []TestCase{
{
Name: "empty string using constructor",
Value: ol.RefOf(""),
Value: ol.NewNullableFrom(""),
OutputBuffer: `""`,
},
{
Name: "hello world string using constructor",
Value: ol.RefOf("hello world"),
Value: ol.NewNullableFrom("hello world"),
OutputBuffer: `"hello world"`,
},
{
Expand Down
6 changes: 2 additions & 4 deletions user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ func TestInviteUserSkipSendInvite(t *testing.T) {
)

client := BestTestClient(t, "user/invite_skip_send_invite", testRequest)
teamMemberRole := ol.UserRoleTeamMember
userInput := ol.UserInput{
Name: ol.RefOf("Kyle Rockman"),
Role: &teamMemberRole,
Role: &ol.UserRoleTeamMember,
SkipWelcomeEmail: ol.RefOf(false),
}
// Act
Expand Down Expand Up @@ -166,9 +165,8 @@ func TestUpdateUser(t *testing.T) {

client := BestTestClient(t, "user/update", testRequest)
// Act
adminRole := ol.UserRoleAdmin
result, err := client.UpdateUser("[email protected]", ol.UserInput{
Role: &adminRole,
Role: &ol.UserRoleAdmin,
SkipWelcomeEmail: ol.RefOf(false),
})
// Assert
Expand Down

0 comments on commit d12cc57

Please sign in to comment.