From ef45f9af74547ed2eddaaeda9cb27b2cbd4f57eb Mon Sep 17 00:00:00 2001 From: Jaz Date: Wed, 20 Mar 2024 12:35:36 -0400 Subject: [PATCH] always warn for deprecated --- comments/comments.go | 2 +- comments/comments_test.go | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/comments/comments.go b/comments/comments.go index cf0501e6..b6a63943 100644 --- a/comments/comments.go +++ b/comments/comments.go @@ -85,7 +85,7 @@ func githubFlagComment(flag ldapi.FeatureFlag, aliases []string, added, extinct func infoCellTemplate() string { return `{{- if eq .Extinct true}} :white_check_mark: all references removed{{- end}} ` + `{{- if eq .Archived true}}{{- if eq .Extinct true}}
{{end}}{{- if eq .Added true}} :warning:{{else}} :information_source:{{- end}} archived on {{.ArchivedAt | date "2006-01-02"}} ` + - `{{- else if eq .Deprecated true}}{{- if eq .Extinct true}}
{{end}}{{- if eq .Added true}} :warning:{{else}} :information_source:{{- end}} deprecated on {{.DeprecatedAt | date "2006-01-02"}}{{- end}}` + `{{- else if eq .Deprecated true}}{{- if eq .Extinct true}}
{{end}} :warning: deprecated on {{.DeprecatedAt | date "2006-01-02"}}{{- end}}` } func GithubNoFlagComment() *github.IssueComment { diff --git a/comments/comments_test.go b/comments/comments_test.go index acd3bb2e..03589ae0 100644 --- a/comments/comments_test.go +++ b/comments/comments_test.go @@ -33,7 +33,8 @@ func newTestAccEnv() *testFlagEnv { archivedFlag.ArchivedDate = ptr(int64(1691072480000)) deprecatedFlag := createFlag("deprecated-flag") - // deprecatedFlag.Deprecated = true + deprecatedFlag.Deprecated = true + deprecatedFlag.DeprecatedDate = ptr(int64(1691072480000)) return &testFlagEnv{ Flag: flag, @@ -147,9 +148,8 @@ func TestGithubFlagComment(t *testing.T) { t.Run("Extinct flag", acceptanceTestEnv.ExtinctFlag) t.Run("Extinct and Archived flag", acceptanceTestEnv.ExtinctAndArchivedFlag) - // TODO need ldapi update to support deprecated flag - // t.Run("Deprecated flag added", acceptanceTestEnv.DeprecatedAdded) - // t.Run("Deprecated flag removed", acceptanceTestEnv.DeprecatedRemoved) + t.Run("Deprecated flag added", acceptanceTestEnv.DeprecatedAdded) + t.Run("Deprecated flag removed", acceptanceTestEnv.DeprecatedRemoved) } func TestProcessFlags(t *testing.T) { @@ -236,7 +236,7 @@ func (e *testFlagEnv) DeprecatedRemoved(t *testing.T) { comment, err := githubFlagComment(e.DeprecatedFlag, []string{}, false, false, &e.Config) require.NoError(t, err) - expected := "| [deprecated flag](https://example.com/test) | `deprecated-flag` | | deprecated on 2023-08-03 |" + expected := "| [deprecated flag](https://example.com/test) | `deprecated-flag` | | :warning: deprecated on 2023-08-03 |" assert.Equal(t, expected, comment) }