github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/utils/outputwriter/icons_test.go (about)

     1  package outputwriter
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestGetSeverityTag(t *testing.T) {
    10  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/applicableCriticalSeverity.png)<br>", getSeverityTag("Critical", "Undetermined"))
    11  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/applicableHighSeverity.png)<br>", getSeverityTag("HiGh", "Undetermined"))
    12  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/applicableMediumSeverity.png)<br>", getSeverityTag("meDium", "Undetermined"))
    13  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/applicableLowSeverity.png)<br>", getSeverityTag("low", "Applicable"))
    14  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/applicableUnknownSeverity.png)<br>", getSeverityTag("none", "Applicable"))
    15  }
    16  
    17  func TestGetSeverityTagNotApplicable(t *testing.T) {
    18  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/notApplicableCritical.png)<br>", getSeverityTag("Critical", "Not Applicable"))
    19  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/notApplicableHigh.png)<br>", getSeverityTag("HiGh", "Not Applicable"))
    20  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/notApplicableMedium.png)<br>", getSeverityTag("meDium", "Not Applicable"))
    21  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/notApplicableLow.png)<br>", getSeverityTag("low", "Not Applicable"))
    22  	assert.Equal(t, "![](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/notApplicableUnknown.png)<br>", getSeverityTag("none", "Not Applicable"))
    23  }
    24  
    25  func TestGetVulnerabilitiesBanners(t *testing.T) {
    26  	assert.Equal(t, "<div align='center'>\n\n[![👍 Frogbot scanned this pull request and found that it did not add vulnerable dependencies.](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/noVulnerabilityBannerPR.png)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/frogbot)\n\n</div>\n", GetBanner(NoVulnerabilityPrBannerSource))
    27  	assert.Equal(t, "<div align='center'>\n\n[![👍 Frogbot scanned this merge request and found that it did not add vulnerable dependencies.](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/noVulnerabilityBannerMR.png)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/frogbot)\n\n</div>\n", GetBanner(NoVulnerabilityMrBannerSource))
    28  	assert.Equal(t, "<div align='center'>\n\n[![🚨 Frogbot scanned this pull request and found the below:](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/vulnerabilitiesBannerPR.png)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/frogbot)\n\n</div>\n", GetBanner(VulnerabilitiesPrBannerSource))
    29  	assert.Equal(t, "<div align='center'>\n\n[![🚨 Frogbot scanned this merge request and found the below:](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/vulnerabilitiesBannerMR.png)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/frogbot)\n\n</div>\n", GetBanner(VulnerabilitiesMrBannerSource))
    30  	assert.Equal(t, "<div align='center'>\n\n[![🚨 This automated pull request was created by Frogbot and fixes the below:](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/vulnerabilitiesFixBannerPR.png)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/frogbot)\n\n</div>\n", GetBanner(VulnerabilitiesFixPrBannerSource))
    31  	assert.Equal(t, "<div align='center'>\n\n[![🚨 This automated merge request was created by Frogbot and fixes the below:](https://raw.githubusercontent.com/jfrog/frogbot/master/resources/v2/vulnerabilitiesFixBannerMR.png)](https://docs.jfrog-applications.jfrog.io/jfrog-applications/frogbot)\n\n</div>\n", GetBanner(VulnerabilitiesFixMrBannerSource))
    32  }
    33  
    34  func TestGetSimplifiedTitle(t *testing.T) {
    35  	assert.Equal(t, "👍 Frogbot scanned this pull request and found that it did not add vulnerable dependencies.", GetSimplifiedTitle(NoVulnerabilityPrBannerSource))
    36  	assert.Equal(t, "🚨 Frogbot scanned this pull request and found the below:", GetSimplifiedTitle(VulnerabilitiesPrBannerSource))
    37  	assert.Equal(t, "🚨 This automated pull request was created by Frogbot and fixes the below:", GetSimplifiedTitle(VulnerabilitiesFixPrBannerSource))
    38  	assert.Equal(t, "", GetSimplifiedTitle("none"))
    39  }