Skip to content

Commit cd50f44

Browse files
committed
Update tests
Signed-off-by: Michael Telatynski <[email protected]>
1 parent 3c12ea5 commit cd50f44

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/unit-tests/stores/ReleaseAnnouncementStore-test.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe("ReleaseAnnouncementStore", () => {
2424
beforeEach(() => {
2525
// Default settings
2626
settings = {
27+
feature_release_announcement: true,
2728
releaseAnnouncementData: {},
2829
};
2930
const watchCallbacks: Array<CallbackFn> = [];
@@ -50,6 +51,13 @@ describe("ReleaseAnnouncementStore", () => {
5051
releaseAnnouncementStore = new ReleaseAnnouncementStore();
5152
});
5253

54+
/**
55+
* Disables the release announcement feature.
56+
*/
57+
function disableReleaseAnnouncement() {
58+
settings["feature_release_announcement"] = false;
59+
}
60+
5361
/**
5462
* Listens to the next release announcement change event.
5563
*/
@@ -63,6 +71,20 @@ describe("ReleaseAnnouncementStore", () => {
6371
expect(ReleaseAnnouncementStore.instance).toBeDefined();
6472
});
6573

74+
it("should return null when the release announcement is disabled", async () => {
75+
disableReleaseAnnouncement();
76+
77+
expect(releaseAnnouncementStore.getReleaseAnnouncement()).toBeNull();
78+
79+
// Wait for the next release announcement change event
80+
const promise = listenReleaseAnnouncementChanged();
81+
// Call the next release announcement
82+
// because the release announcement is disabled, the next release announcement should be null
83+
await releaseAnnouncementStore.nextReleaseAnnouncement();
84+
expect(await promise).toBeNull();
85+
expect(releaseAnnouncementStore.getReleaseAnnouncement()).toBeNull();
86+
});
87+
6688
// We only have a single release announcement currently
6789
it.skip("should return the next feature when the next release announcement is called", async () => {
6890
// Sanity check

0 commit comments

Comments
 (0)