(t *testing.T)
| 21 | } |
| 22 | |
| 23 | func TestAnalyzerBasicSecrets(t *testing.T) { |
| 24 | a := NewAnalyzer([]byte(` |
| 25 | function foo(){ |
| 26 | return { |
| 27 | awsKey: "AKIAIOSFODNN7EXAMPLE", |
| 28 | secret: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" |
| 29 | } |
| 30 | } |
| 31 | `)) |
| 32 | |
| 33 | secrets := a.GetSecrets() |
| 34 | |
| 35 | if len(secrets) != 1 { |
| 36 | t.Errorf("Expected exactly 1 secret; got %d", len(secrets)) |
| 37 | } |
| 38 | |
| 39 | if secrets[0].Kind != "AWSAccessKey" { |
| 40 | t.Errorf("Expected first secret kind to be AWSAccessKey; got %s", secrets[0].Kind) |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | func TestIsProbablyHTML(t *testing.T) { |
| 45 | cases := []struct { |
nothing calls this directly
no test coverage detected