Skip to content

Commit 46124ff

Browse files
committed
add tests for edge cases
1 parent 1140209 commit 46124ff

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

test/unit/migrations/settings/0002-migrate-from-deprecated-icon-names-test.js

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,51 @@ module(
8181

8282
assert.deepEqual(Array.from(result), Array.from(expectedResult));
8383
});
84+
85+
test("migrate empty settings", function (assert) {
86+
const settings = new Map(Object.entries({}));
87+
const result = migrate(settings);
88+
assert.deepEqual(Array.from(result), Array.from(settings));
89+
});
90+
91+
test("migrate same settings", function (assert) {
92+
const settings = new Map(
93+
Object.entries({
94+
header_links: [
95+
{
96+
icon: "fab-facebook",
97+
title: "Desktop and mobile link",
98+
url: "https://facebook.com",
99+
view: "vdm",
100+
target: "blank",
101+
},
102+
{
103+
icon: "fab-twitter",
104+
title: "Mobile-only link",
105+
url: "https://twitter.com",
106+
view: "vmo",
107+
target: "blank",
108+
},
109+
{
110+
icon: "fab-gear",
111+
title: "More settings",
112+
url: "https://example.com",
113+
view: "vmo",
114+
target: "blank",
115+
},
116+
{
117+
icon: "user-group",
118+
title: "Groups",
119+
url: "https://example.com",
120+
view: "vmo",
121+
target: "blank",
122+
},
123+
],
124+
svg_icons: "fab-facebook|fab-twitter|fab-gear|user-group",
125+
})
126+
);
127+
const result = migrate(settings);
128+
assert.deepEqual(Array.from(result), Array.from(settings));
129+
});
84130
}
85131
);

0 commit comments

Comments
 (0)