diff --git a/tests/fixtures/wp-package.json b/tests/fixtures/wp-package.json index 1b006b3..dee4720 100644 --- a/tests/fixtures/wp-package.json +++ b/tests/fixtures/wp-package.json @@ -1,9 +1,9 @@ { - "name": "wordpress", "wordpress": { + "name": "wordpress", "version": "6.4.2", "language": "en_US", - "config": { + "WP_config": { "DB_NAME": "my_db_name", "DB_USER": "my_db_username", "DB_PASSWORD": "my_db_password", diff --git a/tests/utils.test.js b/tests/utils.test.js index 44b32b9..1c7eae8 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -1,17 +1,15 @@ -const { getConfig, getWordPressDownloadUrl, getDownloadUrl } = require('../lib/utils/data.js'); -const { generateSalt, replaceDbConstant, replaceDbConstantBool } = require("../lib/utils/wordpress.js"); -const {getDataFromFile} = require("../lib/utils/wordpress"); +const { getWordPressDownloadUrl, getDownloadUrl } = require('../lib/utils/data.js'); +const { generateSalt, replaceDbConstant, replaceDbConstantBool, getDataFromFile } = require("../lib/utils/parsers.js"); +const {initConfig} = require("../lib/utils/data"); describe('getConfig', () => { it('should read wp-package.json from the root folder and return the default configuration if the file does not exist', async () => { - const argv = undefined; // Call the function - const config = await getConfig(argv); + const config = await initConfig( 'tests', {version: '5.7.1', language: 'en_US'}); // Assert the result expect(config).toBeInstanceOf(Object); - expect(config.name).toBe('wordpress'); - expect(config.wordpress).toMatchObject({"config": {}}); + expect(config.wordpress).toMatchObject({"WP_config": {}, version: '5.7.1', language: 'en_US'}); expect(config.plugins).not.toBeFalsy(); }); }); diff --git a/tests/wpConfig.test.js b/tests/wpConfig.test.js index 3685f21..30fbeae 100644 --- a/tests/wpConfig.test.js +++ b/tests/wpConfig.test.js @@ -1,6 +1,6 @@ const fs = require("fs"); const path = require("path"); -const {parseWpConfig} = require("../lib/utils/wordpress"); +const {parseWpConfig} = require("../lib/utils/parsers.js"); describe('parseWpConfig with real file', () => {