Skip to content

Commit

Permalink
feat(issue): add mutations for activities/componentVersions
Browse files Browse the repository at this point in the history
  • Loading branch information
MR2011 committed Jul 12, 2024
1 parent 335448c commit 847645a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/app/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ var _ = Describe("When modifying relationship of Service and Activity", Label("a
})
})

var _ = Describe("When modifying Issue and Activity", Label("app", "IssueActivity"), func() {
var _ = Describe("When modifying relationship of Issue and Activity", Label("app", "IssueActivityRelationship"), func() {
var (
db *mocks.MockDatabase
heureka app.Heureka
Expand Down
2 changes: 1 addition & 1 deletion internal/app/issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ var _ = Describe("When deleting Issue", Label("app", "DeleteIssue"), func() {
})
})

var _ = Describe("When modifying ComponentVersion and Issue", Label("app", "ComponentVersionIssue"), func() {
var _ = Describe("When modifying relationship of ComponentVersion and Issue", Label("app", "ComponentVersionIssueRelationship"), func() {
var (
db *mocks.MockDatabase
heureka app.Heureka
Expand Down
3 changes: 3 additions & 0 deletions internal/e2e/activity_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,15 @@ var _ = Describe("Modifying Issues of Activity via API", Label("e2e", "ServiceIs
req := graphql.NewRequest(str)

activity := seedCollection.ActivityRows[0].AsActivity()
// find all issues that are assigned to the activity
issueIds := lo.FilterMap(seedCollection.ActivityHasIssueRows, func(row mariadb.ActivityHasIssueRow, _ int) (int64, bool) {
if row.ActivityId.Int64 == activity.Id {
return row.IssueId.Int64, true
}
return 0, false
})

// find an issue that is not assigned to the activity
issueRow, _ := lo.Find(seedCollection.IssueRows, func(row mariadb.IssueRow) bool {
return !lo.Contains(issueIds, row.Id.Int64)
})
Expand Down Expand Up @@ -577,6 +579,7 @@ var _ = Describe("Modifying Issues of Activity via API", Label("e2e", "ServiceIs

activity := seedCollection.ActivityRows[0].AsActivity()

// find an issue that is assigned to the activity
issueRow, _ := lo.Find(seedCollection.ActivityHasIssueRows, func(row mariadb.ActivityHasIssueRow) bool {
return row.ActivityId.Int64 == activity.Id
})
Expand Down
5 changes: 4 additions & 1 deletion internal/e2e/issue_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ var _ = Describe("Deleting Issue via API", Label("e2e", "Issues"), func() {
})
})

var _ = Describe("Modifying ComponentVersion of Issue via API", Label("e2e", "Issues"), func() {
var _ = Describe("Modifying relationship of ComponentVersion of Issue via API", Label("e2e", "ComponentVersionIssueRelationship"), func() {

var seeder *test.DatabaseSeeder
var s *server.Server
Expand Down Expand Up @@ -441,13 +441,15 @@ var _ = Describe("Modifying ComponentVersion of Issue via API", Label("e2e", "Is
req := graphql.NewRequest(str)

issue := seedCollection.IssueRows[0].AsIssue()
// find all componentVersions that are assigned to the issue
componentVersionIds := lo.FilterMap(seedCollection.ComponentVersionIssueRows, func(row mariadb.ComponentVersionIssueRow, _ int) (int64, bool) {
if row.IssueId.Int64 == issue.Id {
return row.ComponentVersionId.Int64, true
}
return 0, false
})

// find a componentVersion that is not assigned to the issue
componentVersionRow, _ := lo.Find(seedCollection.ComponentVersionRows, func(row mariadb.ComponentVersionRow) bool {
return !lo.Contains(componentVersionIds, row.Id.Int64)
})
Expand Down Expand Up @@ -485,6 +487,7 @@ var _ = Describe("Modifying ComponentVersion of Issue via API", Label("e2e", "Is

issue := seedCollection.IssueRows[0].AsIssue()

// find a componentVersion that is assigned to the issue
componentVersionRow, _ := lo.Find(seedCollection.ComponentVersionIssueRows, func(row mariadb.ComponentVersionIssueRow) bool {
return row.IssueId.Int64 == issue.Id
})
Expand Down

0 comments on commit 847645a

Please sign in to comment.