Skip to content

Commit f625c95

Browse files
committed
fix(TEST): trim test-config.yaml to overrides-only and fix defaultConfig mutation
test-config.yaml now specifies only values that differ from defaultConfig.js; all other values are filled via mergeObjects at load time. This uncovered two latent bugs: 1. enable-disable-versions.spec.js used shallow spread on defaultConfig then mutated nested V1/V2.ENABLE, permanently corrupting the in-memory defaults for subsequent tests. Fixed with deep copy. 2. withConfigOverride assumed currentConfig.V1 always existed in the legacy-override branch. Added null guard.
1 parent a8b082a commit f625c95

3 files changed

Lines changed: 6 additions & 51 deletions

File tree

tests/v2/config/test-config.yaml

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,7 @@
11
APP:
2-
CW_PORT: 31310
3-
BIND_ADDRESS: localhost
4-
DATALAYER_URL: https://localhost:8562
5-
WALLET_URL: https://localhost:9256
62
USE_SIMULATOR: true
7-
CHIA_NETWORK: mainnet
8-
USE_DEVELOPMENT_MODE: false
9-
DEFAULT_FEE: 3000
10-
DEFAULT_COIN_AMOUNT: 300
11-
CERTIFICATE_FOLDER_PATH: null
12-
DATALAYER_FILE_SERVER_URL: null
13-
AUTO_SUBSCRIBE_FILESTORE: false
14-
AUTO_MIRROR_EXTERNAL_STORES: true
15-
LOG_LEVEL: info
163
TASKS:
17-
GOVERNANCE_SYNC_TASK_INTERVAL: 30
18-
DEFAULT_ORGANIZATIONS_SYNC_TASK_INTERVAL: 30
19-
ORGANIZATION_META_SYNC_TASK_INTERVAL: 300
20-
PICKLIST_SYNC_TASK_INTERVAL: 30
214
MIRROR_CHECK_TASK_INTERVAL: 86460
22-
VALIDATE_ORGANIZATION_TABLE_TASK_INTERVAL: 1800
23-
REQUEST_CONTENT_LIMITS:
24-
STAGING:
25-
EDIT_DATA_LEN: 200
26-
UNITS:
27-
INCLUDE_COLUMNS_LEN: 200
28-
MARKETPLACE_IDENTIFIERS_LEN: 200
29-
PROJECTS:
30-
INCLUDE_COLUMNS_LEN: 200
31-
PROJECT_IDS_LEN: 200
32-
V1:
33-
ENABLE: true
34-
READ_ONLY: false
35-
CADT_API_KEY: null
36-
IS_GOVERNANCE_BODY: false
37-
GOVERNANCE:
38-
GOVERNANCE_BODY_ID: 23f6498e015ebcd7190c97df30c032de8deb5c8934fc1caa928bc310e2b8a57e
39-
MIRROR_DB:
40-
DB_USERNAME: null
41-
DB_PASSWORD: null
42-
DB_NAME: null
43-
DB_HOST: null
445
V2:
45-
ENABLE: true
46-
READ_ONLY: false
47-
CADT_API_KEY: null
48-
IS_GOVERNANCE_BODY: false
496
GOVERNANCE:
507
GOVERNANCE_BODY_ID: ''
51-
MIRROR_DB:
52-
DB_USERNAME: null
53-
DB_PASSWORD: null
54-
DB_NAME: null
55-
DB_HOST: null

tests/v2/integration/enable-disable-versions.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ describe('V1/V2 Enable/Disable Functionality Tests', function () {
6464

6565
// Helper function to write unified config
6666
const writeUnifiedConfig = (v1Enable, v2Enable) => {
67-
const testConfig = { ...defaultConfig };
67+
const testConfig = JSON.parse(JSON.stringify(defaultConfig));
6868
testConfig.V1.ENABLE = v1Enable;
6969
testConfig.V2.ENABLE = v2Enable;
7070
// Ensure directory exists
@@ -158,7 +158,7 @@ describe('V1/V2 Enable/Disable Functionality Tests', function () {
158158
});
159159

160160
it('should respect ENABLE: false in V1 config', function () {
161-
const testConfig = { ...defaultConfig };
161+
const testConfig = JSON.parse(JSON.stringify(defaultConfig));
162162
testConfig.V1.ENABLE = false;
163163
const configDir = path.dirname(unifiedConfigPath);
164164
if (!fs.existsSync(configDir)) {
@@ -173,7 +173,7 @@ describe('V1/V2 Enable/Disable Functionality Tests', function () {
173173
});
174174

175175
it('should respect ENABLE: false in V2 config', function () {
176-
const testConfig = { ...defaultConfig };
176+
const testConfig = JSON.parse(JSON.stringify(defaultConfig));
177177
testConfig.V2.ENABLE = false;
178178
const configDir = path.dirname(unifiedConfigPath);
179179
if (!fs.existsSync(configDir)) {

tests/v2/utils/v2-test-helpers.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,9 @@ export const withConfigOverride = async (testFn, configOverrides) => {
619619
// Legacy support: if override keys don't match sections, merge into V1
620620
// This handles old-style overrides like { GOVERNANCE: { ... }, MIRROR_DB: { ... } }
621621
// These are V1-specific sections
622+
if (!currentConfig.V1) {
623+
currentConfig.V1 = {};
624+
}
622625
if (!currentConfig.V1[section]) {
623626
currentConfig.V1[section] = {};
624627
}

0 commit comments

Comments
 (0)