Add unified setup script (configure.js) merging deploy + config wizard
Single-file Node.js CLI that orchestrates the full setup lifecycle: - Interactive env var configuration with validation and smart defaults - Postgres provisioning via Docker Compose with readiness polling - Schema initialization (psql with docker exec fallback) - npm dependency installation with 120s timeout - Optional SQLite-to-Postgres data migration with retry logic - Frontend build with smart skip on reconfiguration Includes 84 tests: 50 property-based (fast-check) covering 19 correctness properties, and 34 integration tests for filesystem and parsing flows.
This commit is contained in:
64
backend/__tests__/config-wizard-masking.property.test.js
Normal file
64
backend/__tests__/config-wizard-masking.property.test.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Property-Based Tests: Config Wizard Sensitive Value Masking
|
||||
*
|
||||
* Feature: config-wizard
|
||||
*
|
||||
* Tests the maskSensitive display function from `configure.js`.
|
||||
*
|
||||
* Validates: Requirements 3.4
|
||||
*/
|
||||
|
||||
const fc = require('fast-check');
|
||||
const { maskSensitive } = require('../../configure.js');
|
||||
|
||||
// --- Property 4: Sensitive value masking ---
|
||||
describe('Property 4: Sensitive value masking', () => {
|
||||
/**
|
||||
* **Validates: Requirements 3.4**
|
||||
*
|
||||
* For any string value longer than 8 characters, maskSensitive returns
|
||||
* first4 + '****' + last4. For any string value of 8 characters or fewer,
|
||||
* maskSensitive returns the full value unchanged.
|
||||
*/
|
||||
test('strings longer than 8 chars are masked as first4 + **** + last4', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.string({ minLength: 9, maxLength: 200 }),
|
||||
(value) => {
|
||||
const result = maskSensitive('ANY_NAME', value);
|
||||
const expected = value.slice(0, 4) + '****' + value.slice(-4);
|
||||
return result === expected;
|
||||
}
|
||||
),
|
||||
{ numRuns: 100 }
|
||||
);
|
||||
});
|
||||
|
||||
test('strings of 8 chars or fewer are returned unchanged', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.string({ minLength: 0, maxLength: 8 }),
|
||||
(value) => {
|
||||
const result = maskSensitive('ANY_NAME', value);
|
||||
return result === value;
|
||||
}
|
||||
),
|
||||
{ numRuns: 100 }
|
||||
);
|
||||
});
|
||||
|
||||
test('masking behavior is independent of the variable name parameter', () => {
|
||||
fc.assert(
|
||||
fc.property(
|
||||
fc.string({ minLength: 9, maxLength: 100 }),
|
||||
fc.string({ minLength: 1, maxLength: 50 }),
|
||||
(value, name) => {
|
||||
const result = maskSensitive(name, value);
|
||||
const expected = value.slice(0, 4) + '****' + value.slice(-4);
|
||||
return result === expected;
|
||||
}
|
||||
),
|
||||
{ numRuns: 100 }
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user