Skip to content

Commit

Permalink
ci(go): snapshots to annotations for gosec
Browse files Browse the repository at this point in the history
  • Loading branch information
gotbadger committed Feb 22, 2024
1 parent 43ffdbc commit 2817adf
Show file tree
Hide file tree
Showing 99 changed files with 843 additions and 3,808 deletions.
83 changes: 0 additions & 83 deletions tests/go/gosec/blocklist/cgi/__snapshots__/test.js.snap

This file was deleted.

40 changes: 27 additions & 13 deletions tests/go/gosec/blocklist/cgi/test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
const { createInvoker, getEnvironment } = require("../../../../helper.js")
const {
createNewInvoker,
getEnvironment,
} = require("../../../../../helper.js")
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname)

describe(ruleId, () => {
const invoke = createInvoker(ruleId, ruleFile, testBase)

test("test", () => {
const testCase = "main.go"
expect(invoke(testCase)).toMatchSnapshot()
})

test("test 2", () => {
const testCase = "main2.go"
expect(invoke(testCase)).toMatchSnapshot()
})
})
const invoke = createNewInvoker(ruleId, ruleFile, testBase)


test("main", () => {
const testCase = "main.go"

const results = invoke(testCase)

expect(results.Missing).toEqual([])
expect(results.Extra).toEqual([])
})


test("main2", () => {
const testCase = "main2.go"

const results = invoke(testCase)

expect(results.Missing).toEqual([])
expect(results.Extra).toEqual([])
})

})
1 change: 1 addition & 0 deletions tests/go/gosec/blocklist/cgi/testdata/main.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package main

// bearer:expected go_gosec_blocklist_cgi
import "net/http/cgi"

func maincgi() {
Expand Down
1 change: 1 addition & 0 deletions tests/go/gosec/blocklist/cgi/testdata/main2.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
// bearer:expected go_gosec_blocklist_cgi
cgi2 "net/http/cgi"
)

Expand Down
42 changes: 0 additions & 42 deletions tests/go/gosec/blocklist/des/__snapshots__/test.js.snap

This file was deleted.

23 changes: 16 additions & 7 deletions tests/go/gosec/blocklist/des/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
const { createInvoker, getEnvironment } = require("../../../../helper.js")
const {
createNewInvoker,
getEnvironment,
} = require("../../../../../helper.js")
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname)

describe(ruleId, () => {
const invoke = createInvoker(ruleId, ruleFile, testBase)
const invoke = createNewInvoker(ruleId, ruleFile, testBase)

test("test", () => {
const testCase = "main.go"
expect(invoke(testCase)).toMatchSnapshot()
})
})

test("main", () => {
const testCase = "main.go"

const results = invoke(testCase)

expect(results.Missing).toEqual([])
expect(results.Extra).toEqual([])
})

})
1 change: 1 addition & 0 deletions tests/go/gosec/blocklist/des/testdata/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
// bearer:expected go_gosec_blocklist_des
"crypto/des"
"fmt"
)
Expand Down
42 changes: 0 additions & 42 deletions tests/go/gosec/blocklist/md5/__snapshots__/test.js.snap

This file was deleted.

23 changes: 16 additions & 7 deletions tests/go/gosec/blocklist/md5/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
const { createInvoker, getEnvironment } = require("../../../../helper.js")
const {
createNewInvoker,
getEnvironment,
} = require("../../../../../helper.js")
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname)

describe(ruleId, () => {
const invoke = createInvoker(ruleId, ruleFile, testBase)
const invoke = createNewInvoker(ruleId, ruleFile, testBase)

test("test", () => {
const testCase = "main.go"
expect(invoke(testCase)).toMatchSnapshot()
})
})

test("main", () => {
const testCase = "main.go"

const results = invoke(testCase)

expect(results.Missing).toEqual([])
expect(results.Extra).toEqual([])
})

})
1 change: 1 addition & 0 deletions tests/go/gosec/blocklist/md5/testdata/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
// bearer:expected go_gosec_blocklist_md5
"crypto/md5"
"fmt"
)
Expand Down
42 changes: 0 additions & 42 deletions tests/go/gosec/blocklist/rc4/__snapshots__/test.js.snap

This file was deleted.

23 changes: 16 additions & 7 deletions tests/go/gosec/blocklist/rc4/test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
const { createInvoker, getEnvironment } = require("../../../../helper.js")
const {
createNewInvoker,
getEnvironment,
} = require("../../../../../helper.js")
const { ruleId, ruleFile, testBase } = getEnvironment(__dirname)

describe(ruleId, () => {
const invoke = createInvoker(ruleId, ruleFile, testBase)
const invoke = createNewInvoker(ruleId, ruleFile, testBase)

test("test", () => {
const testCase = "main.go"
expect(invoke(testCase)).toMatchSnapshot()
})
})

test("main", () => {
const testCase = "main.go"

const results = invoke(testCase)

expect(results.Missing).toEqual([])
expect(results.Extra).toEqual([])
})

})
1 change: 1 addition & 0 deletions tests/go/gosec/blocklist/rc4/testdata/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
// bearer:expected go_gosec_blocklist_rc4
"crypto/rc4"
"fmt"
)
Expand Down
Loading

0 comments on commit 2817adf

Please sign in to comment.