An understanding test checks whether a mental model of a system matches its actual behavior. It encodes one specific claim, rather than chasing coverage. section 4.3
Use the test to turn uncertain code reading into a falsifiable investigation:
- Trace the relevant execution path and state a concrete behavioral hypothesis. section 4.0
- Generate scenarios that could confirm or contradict the hypothesis, then run them. section 4.3
- Treat a failure as evidence about the system, not merely as a broken test. section 4.3
URI path cleanup versus validation
A trace suggested that VS Code silently fixes paths without leading slashes. Tests exposed the sharper rule: http and file schemes clean the path before validation, while a custom scheme can still throw. The test revealed ordering that code inspection had missed. section 4.3
test('authority + bad path throws in strict mode', () => {
assert.throws(() => {
URI.from({
scheme: 'http',
authority: 'example.com',
path: 'no-leading-slash'
}, true);
});
});This assertion tests whether strict URI construction rejects a path lacking a leading slash. section 4.3
