-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Why this change? It isn't really in our convention to use uppercase characters in settings so we are renaming the settings.
- Loading branch information
Showing
5 changed files
with
100 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export default function migrate(settings) { | ||
if (settings.has("Heading")) { | ||
settings.set("heading", settings.get("Heading")); | ||
settings.delete("Heading"); | ||
} | ||
|
||
if (settings.has("Blurb")) { | ||
settings.set("blurb", settings.get("Blurb")); | ||
settings.delete("Blurb"); | ||
} | ||
|
||
if (settings.has("Link_sections")) { | ||
settings.set("link_sections", settings.get("Link_sections")); | ||
settings.delete("Link_sections"); | ||
} | ||
|
||
if (settings.has("Links")) { | ||
settings.set("links", settings.get("Links")); | ||
settings.delete("Links"); | ||
} | ||
|
||
if (settings.has("Small_links")) { | ||
settings.set("small_links", settings.get("Small_links")); | ||
settings.delete("Small_links"); | ||
} | ||
|
||
if (settings.has("Social_links")) { | ||
settings.set("social_links", settings.get("Social_links")); | ||
settings.delete("Social_links"); | ||
} | ||
|
||
if (settings.has("Show_footer_on_login_required_page")) { | ||
settings.set( | ||
"show_footer_on_login_required_page", | ||
settings.get("Show_footer_on_login_required_page") | ||
); | ||
settings.delete("Show_footer_on_login_required_page"); | ||
} | ||
|
||
return settings; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
test/unit/migrations/settings/0001-rename-settings-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { module, test } from "qunit"; | ||
import migrate from "../../../../migrations/settings/0001-rename-settings"; | ||
|
||
module("Unit | Migrations | Settings | 0001-rename-settings", function () { | ||
test("migrate", function (assert) { | ||
const settings = new Map( | ||
Object.entries({ | ||
Heading: "some header", | ||
Blurb: "some blurb", | ||
Link_sections: "section1|section2", | ||
Links: "some_links", | ||
Small_links: "some,small,links", | ||
Social_links: "some,social,links", | ||
Show_footer_on_login_required_page: true, | ||
}) | ||
); | ||
|
||
const result = migrate(settings); | ||
|
||
assert.deepEqual( | ||
Array.from(result), | ||
Array.from( | ||
new Map( | ||
Object.entries({ | ||
heading: "some header", | ||
blurb: "some blurb", | ||
link_sections: "section1|section2", | ||
links: "some_links", | ||
small_links: "some,small,links", | ||
social_links: "some,social,links", | ||
show_footer_on_login_required_page: true, | ||
}) | ||
) | ||
) | ||
); | ||
}); | ||
}); |