MCPcopy
hub / github.com/BishopFox/jsluice / TestAnalyzerBasicURLs

Function TestAnalyzerBasicURLs

analyzer_test.go:5–21  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestAnalyzerBasicURLs(t *testing.T) {
6 a := NewAnalyzer([]byte(`
7 function foo(){
8 document.location = "/logout"
9 }
10 `))
11
12 urls := a.GetURLs()
13
14 if len(urls) < 1 {
15 t.Errorf("Expected at least 1 URL; got %d", len(urls))
16 }
17
18 if urls[0].URL != "/logout" {
19 t.Errorf("Expected first URL to be '/logout'; got %s", urls[0].URL)
20 }
21}
22
23func TestAnalyzerBasicSecrets(t *testing.T) {
24 a := NewAnalyzer([]byte(`

Callers

nothing calls this directly

Calls 2

GetURLsMethod · 0.95
NewAnalyzerFunction · 0.85

Tested by

no test coverage detected