9
9
"github.com/ignite/cli/v28/ignite/pkg/announcements"
10
10
)
11
11
12
- func TestGetAnnouncements (t * testing.T ) {
12
+ func TestFetchAnnouncements (t * testing.T ) {
13
13
fallbackData := fmt .Sprintf ("\n 💬 Survey: %s\n " , announcements .SurveyLink )
14
14
15
15
tests := []struct {
@@ -20,9 +20,9 @@ func TestGetAnnouncements(t *testing.T) {
20
20
}{
21
21
{
22
22
name : "successful retrieval" ,
23
- mockResponse : `{"announcements":["Announcement 1","Announcement 2" ]}` ,
23
+ mockResponse : `{"version":1," announcements":[{"id":"1744230503810","text":"New Ignite announcement: v1.0.0 released!","timestamp":"2025-04-09T20:28:23.810Z","user":"announcement-bot"} ]}` ,
24
24
statusCode : http .StatusOK ,
25
- expected : "\n 🗣️ Announcements\n ⋆ Announcement 1 \n ⋆ Announcement 2 \n " ,
25
+ expected : "\n 🗣️ Announcements\n ⋆ New Ignite announcement: v1.0.0 released! \n " ,
26
26
},
27
27
{
28
28
name : "empty announcements" ,
@@ -52,11 +52,11 @@ func TestGetAnnouncements(t *testing.T) {
52
52
}))
53
53
defer server .Close ()
54
54
55
- originalAPI := announcements .AnnouncementAPI
56
- announcements .AnnouncementAPI = server .URL
57
- defer func () { announcements .AnnouncementAPI = originalAPI }()
55
+ originalAPI := announcements .APIURL
56
+ announcements .APIURL = server .URL
57
+ defer func () { announcements .APIURL = originalAPI }()
58
58
59
- result := announcements .GetAnnouncements ()
59
+ result := announcements .Fetch ()
60
60
if result != tt .expected {
61
61
t .Errorf ("expected %q, got %q" , tt .expected , result )
62
62
}
0 commit comments