feat(06-02): implement JSONFormatter with Unmask support
- Renders findings as 2-space indented JSON array - Honors Options.Unmask for key field exposure - Omits empty verify fields via json omitempty - Registers under "json" in output registry
This commit is contained in:
@@ -142,8 +142,12 @@ func TestJSONFormatter_Indented(t *testing.T) {
|
||||
if err := (JSONFormatter{}).Format([]engine.Finding{f}, &buf, Options{}); err != nil {
|
||||
t.Fatalf("Format returned error: %v", err)
|
||||
}
|
||||
// Expect 2-space indent on at least one property line.
|
||||
if !strings.Contains(buf.String(), "\n \"provider\"") {
|
||||
t.Errorf("output not indented with 2 spaces:\n%s", buf.String())
|
||||
// Expect 2-space indent: array items at 2 spaces, nested fields at 4 spaces.
|
||||
s := buf.String()
|
||||
if !strings.Contains(s, "\n {") {
|
||||
t.Errorf("array item not indented with 2 spaces:\n%s", s)
|
||||
}
|
||||
if !strings.Contains(s, "\n \"provider\"") {
|
||||
t.Errorf("nested field not indented with 4 spaces:\n%s", s)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user