package bulldozesynclabel //var c = &plugin.MockGithubClient{GithubIssues: &plugin.MockIssueService{}, GithubPullRequests: &plugin.MockPullRequestService{}} //var hp = &plugin.HandlerParams{ // Ctx: context.Background(), // Client: c, // Org: "some-org", // Repo: "some-repo", // Log: zerolog.New(os.Stdout).With().Timestamp().Logger(), //} // test that an ok-to-sync label is added and then removed in sequence //func TestLabel(t *testing.T) { // c.GithubIssues = &plugin.MockIssueService{Labels: []string{}} // // // test if the status event will trigger jack to add the ok-to-sync label // se := &github.StatusEvent{ // Name: github.String("ncrvoyix-swt-retail/edge-infra"), // TargetURL: github.String("https://policy-bot.edge-infra.dev/details/ncrvoyix-swt-retail/edge-infra/2392"), // Context: github.String("mergeable: master"), // Description: github.String("All rules are approved"), // State: github.String("success"), // } // handleStatusEvent(*hp, *se) // // ct := &plugin.MockGithubClient{GithubIssues: &plugin.MockIssueService{Labels: []string{constants.OkToSync}}} // // if !reflect.DeepEqual(ct.GithubIssues, c.GithubIssues) { // t.Error("Failed to add the ok-to-sync label") // } // // // test if jack will ignore other contexts // se.Context = github.String("some-other-plugin") // se.State = github.String("failure") // handleStatusEvent(*hp, *se) // // if !reflect.DeepEqual(ct.GithubIssues, c.GithubIssues) { // t.Error("Failed to ignore status event") // } // // // TODO re-enable this once https://github.com/ncrvoyix-swt-retail/edge-infra/pull/2564 // // has been merged so we can use the relatedissue feature // // this will error until then because we need to get the labels from a related issue // // se.Context = github.String("mergeable: master") // // se.State = github.String("failure") // // // handleStatusEvent(*hp, *se) // // // ct = &plugin.MockGithubClient{GithubIssues: &plugin.MockIssueService{Labels: []string{}}} // // // if !reflect.DeepEqual(ct.GithubIssues, c.GithubIssues) { // // t.Error("Failed to remove the ok-to-sync label") // // } //}