diff --git a/src/classes/Settings.js b/src/classes/Settings.js index 3aa511afb..5779bab39 100644 --- a/src/classes/Settings.js +++ b/src/classes/Settings.js @@ -14,7 +14,7 @@ const { // Constants const FOOTER_PATH = "footer.yml" const NAVIGATION_PATH = "navigation.yml" -const { HOMEPAGE_NAME } = require("@root/constants") +const { HOMEPAGE_FILENAME } = require("@root/constants") const retrieveSettingsFiles = async ( accessToken, @@ -42,7 +42,7 @@ const retrieveSettingsFiles = async ( // Retrieve homepage only if flag is set to true if (shouldRetrieveHomepage) { - fileRetrievalObj.homepage = HomepageFile.read(HOMEPAGE_NAME) + fileRetrievalObj.homepage = HomepageFile.read(HOMEPAGE_FILENAME) } const fileContentsArr = await Bluebird.map( @@ -233,7 +233,7 @@ class Settings { const homepageContent = ["---\n", homepageFrontMatter, "---"].join("") const newHomepageContent = Base64.encode(homepageContent) - await HomepageFile.update(HOMEPAGE_NAME, newHomepageContent, sha) + await HomepageFile.update(HOMEPAGE_FILENAME, newHomepageContent, sha) } } diff --git a/src/routes/v1/authenticatedSites/homepage.js b/src/routes/v1/authenticatedSites/homepage.js index 54410032b..586b9cec0 100644 --- a/src/routes/v1/authenticatedSites/homepage.js +++ b/src/routes/v1/authenticatedSites/homepage.js @@ -12,7 +12,7 @@ const { const { File, HomepageType } = require("@classes/File") // Constants -const { HOMEPAGE_NAME } = require("@root/constants") +const { HOMEPAGE_FILENAME } = require("@root/constants") // Read homepage index file async function readHomepage(req, res) { @@ -24,7 +24,9 @@ async function readHomepage(req, res) { const IsomerFile = new File(accessToken, siteName) const homepageType = new HomepageType() IsomerFile.setFileType(homepageType) - const { sha, content: encodedContent } = await IsomerFile.read(HOMEPAGE_NAME) + const { sha, content: encodedContent } = await IsomerFile.read( + HOMEPAGE_FILENAME + ) const content = Base64.decode(encodedContent) // TO-DO: @@ -48,7 +50,7 @@ async function updateHomepage(req, res) { const homepageType = new HomepageType() IsomerFile.setFileType(homepageType) const { newSha } = await IsomerFile.update( - HOMEPAGE_NAME, + HOMEPAGE_FILENAME, Base64.encode(content), sha ) diff --git a/src/services/fileServices/MdPageServices/HomepagePageService.js b/src/services/fileServices/MdPageServices/HomepagePageService.js index cf82590df..940c6d136 100644 --- a/src/services/fileServices/MdPageServices/HomepagePageService.js +++ b/src/services/fileServices/MdPageServices/HomepagePageService.js @@ -3,7 +3,7 @@ const { convertDataToMarkdown, } = require("@utils/markdown-utils") -const { HOMEPAGE_NAME } = require("@root/constants") +const { HOMEPAGE_FILENAME } = require("@root/constants") class HomepagePageService { constructor({ gitHubService }) { @@ -14,7 +14,7 @@ class HomepagePageService { const { content: rawContent, sha } = await this.gitHubService.read( sessionData, { - fileName: HOMEPAGE_NAME, + fileName: HOMEPAGE_FILENAME, } ) const { frontMatter, pageContent } = retrieveDataFromMarkdown(rawContent) @@ -26,7 +26,7 @@ class HomepagePageService { const { newSha } = await this.gitHubService.update(sessionData, { fileContent: newContent, sha, - fileName: HOMEPAGE_NAME, + fileName: HOMEPAGE_FILENAME, }) return { content: { frontMatter, pageBody: content }, diff --git a/src/services/fileServices/MdPageServices/__tests__/HomepagePageService.spec.js b/src/services/fileServices/MdPageServices/__tests__/HomepagePageService.spec.js index e12c6d9c0..213bf8951 100644 --- a/src/services/fileServices/MdPageServices/__tests__/HomepagePageService.spec.js +++ b/src/services/fileServices/MdPageServices/__tests__/HomepagePageService.spec.js @@ -3,7 +3,7 @@ const { homepageSha: mockHomepageSha, rawHomepageContent: mockRawHomepageContent, } = require("@fixtures/homepage") -const { HOMEPAGE_NAME } = require("@root/constants") +const { HOMEPAGE_FILENAME } = require("@root/constants") describe("Homepage Page Service", () => { const siteName = "test-site" @@ -58,7 +58,7 @@ describe("Homepage Page Service", () => { mockRawHomepageContent ) expect(mockGithubService.read).toHaveBeenCalledWith(reqDetails, { - fileName: HOMEPAGE_NAME, + fileName: HOMEPAGE_FILENAME, }) }) }) @@ -69,7 +69,7 @@ describe("Homepage Page Service", () => { it("Updating page content works correctly", async () => { await expect( service.update(reqDetails, { - fileName: HOMEPAGE_NAME, + fileName: HOMEPAGE_FILENAME, content: mockContent, frontMatter: mockFrontMatter, sha: oldSha, @@ -84,7 +84,7 @@ describe("Homepage Page Service", () => { mockContent ) expect(mockGithubService.update).toHaveBeenCalledWith(reqDetails, { - fileName: HOMEPAGE_NAME, + fileName: HOMEPAGE_FILENAME, fileContent: mockRawHomepageContent, sha: oldSha, })