diff --git a/cmd/spectral_report_test.go b/cmd/spectral_report_test.go index f67810de..24638c85 100644 --- a/cmd/spectral_report_test.go +++ b/cmd/spectral_report_test.go @@ -5,6 +5,7 @@ import ( "github.com/stretchr/testify/assert" "io" "os" + "strings" "testing" ) @@ -41,6 +42,34 @@ func TestGetSpectralReportCommand_CustomName(t *testing.T) { defer os.Remove("blue-shoes.json") } +func TestGetSpectralReportCommand_StdInOut(t *testing.T) { + cmd := GetSpectralReportCommand() + b := bytes.NewBufferString("") + cmd.SetOut(b) + cmd.SetArgs([]string{"-i", "-o"}) + cmd.SetIn(strings.NewReader("openapi: 3.1.0")) + cmdErr := cmd.Execute() + outBytes, err := io.ReadAll(b) + + assert.NoError(t, cmdErr) + assert.NoError(t, err) + assert.NotNil(t, outBytes) +} + +func TestGetSpectralReportCommand_StdInOutNoPretty(t *testing.T) { + cmd := GetSpectralReportCommand() + b := bytes.NewBufferString("") + cmd.SetOut(b) + cmd.SetArgs([]string{"-i", "-o", "-n"}) + cmd.SetIn(strings.NewReader("openapi: 3.1.0")) + cmdErr := cmd.Execute() + outBytes, err := io.ReadAll(b) + + assert.NoError(t, cmdErr) + assert.NoError(t, err) + assert.NotNil(t, outBytes) +} + func TestGetSpectralReportCommand_CustomRuleset(t *testing.T) { cmd := GetSpectralReportCommand() // global flag exists on root only. diff --git a/cmd/vacuum_report_test.go b/cmd/vacuum_report_test.go index 57d591d9..493c8664 100644 --- a/cmd/vacuum_report_test.go +++ b/cmd/vacuum_report_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/assert" "io" "os" + "strings" "testing" "time" ) @@ -29,6 +30,34 @@ func TestGetVacuumReportCommand(t *testing.T) { defer os.Remove(file) } +func TestGetVacuumReportCommand_StdInOut(t *testing.T) { + cmd := GetVacuumReportCommand() + b := bytes.NewBufferString("") + cmd.SetOut(b) + cmd.SetArgs([]string{"-i", "-o"}) + cmd.SetIn(strings.NewReader("openapi: 3.1.0")) + cmdErr := cmd.Execute() + outBytes, err := io.ReadAll(b) + + assert.NoError(t, cmdErr) + assert.NoError(t, err) + assert.NotNil(t, outBytes) +} + +func TestGetVacuumReportCommand_NoPretty(t *testing.T) { + cmd := GetVacuumReportCommand() + b := bytes.NewBufferString("") + cmd.SetOut(b) + cmd.SetArgs([]string{"-i", "-o", "-n"}) + cmd.SetIn(strings.NewReader("openapi: 3.1.0")) + cmdErr := cmd.Execute() + outBytes, err := io.ReadAll(b) + + assert.NoError(t, cmdErr) + assert.NoError(t, err) + assert.NotNil(t, outBytes) +} + func TestGetVacuumReportCommand_Compress(t *testing.T) { cmd := GetVacuumReportCommand() b := bytes.NewBufferString("") diff --git a/html-report/ui/src/components/violation-drawer/violation-drawer-component.ts b/html-report/ui/src/components/violation-drawer/violation-drawer-component.ts index d8e5dcde..52019453 100644 --- a/html-report/ui/src/components/violation-drawer/violation-drawer-component.ts +++ b/html-report/ui/src/components/violation-drawer/violation-drawer-component.ts @@ -62,8 +62,8 @@ export class ViolationDrawerComponent extends BaseComponent {

Learn more about: ${this.ruleId}