mirror of
https://github.com/karust/openserp.git
synced 2026-08-12 11:53:29 +08:00
39 lines
803 B
Go
39 lines
803 B
Go
package detectors
|
|
|
|
import "testing"
|
|
|
|
func TestRebrowserChecksToDetections_UsesIconAndRating(t *testing.T) {
|
|
checks := []rebrowserCheck{
|
|
{
|
|
Type: "navigatorWebdriver",
|
|
Icon: "🔴",
|
|
Rating: -1,
|
|
Note: "Own properties detected",
|
|
},
|
|
{
|
|
Type: "runtimeEnableLeak",
|
|
Icon: "",
|
|
Rating: 1,
|
|
Note: "runtime leak",
|
|
},
|
|
{
|
|
Type: "viewport",
|
|
Icon: "🟢",
|
|
Rating: 1,
|
|
Note: "looks fine",
|
|
},
|
|
}
|
|
|
|
detections := rebrowserChecksToDetections(checks)
|
|
|
|
if !detections["navigatorwebdriver"].Detected {
|
|
t.Fatal("expected red icon check to be detected")
|
|
}
|
|
if !detections["runtimeenableleak"].Detected {
|
|
t.Fatal("expected rating>=1 check to be detected")
|
|
}
|
|
if detections["viewport"].Detected {
|
|
t.Fatal("expected green icon check to be not detected")
|
|
}
|
|
}
|