广告点击添加
This commit is contained in:
@@ -80,3 +80,27 @@ func TestBuildAppConfigVMIncludesValidAdvertisements(t *testing.T) {
|
||||
t.Fatalf("DialogList[0] = %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdvertisementClickTrackable(t *testing.T) {
|
||||
cases := []struct {
|
||||
ad Advertisement
|
||||
wantID int64
|
||||
trackable bool
|
||||
}{
|
||||
{Advertisement{ID: "1138200002", Location: 2}, 1138200002, true},
|
||||
{Advertisement{ID: " 1138200012 ", Location: 12}, 1138200012, true},
|
||||
{Advertisement{ID: "1138200003", Location: 0}, 1138200003, false},
|
||||
{Advertisement{ID: "", Location: 3}, 0, false},
|
||||
{Advertisement{ID: "0", Location: 3}, 0, false},
|
||||
{Advertisement{ID: "-5", Location: 3}, 0, false},
|
||||
{Advertisement{ID: "abc", Location: 3}, 0, false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
if got := tc.ad.ClickID(); got != tc.wantID {
|
||||
t.Fatalf("ClickID(%q) = %d, want %d", tc.ad.ID, got, tc.wantID)
|
||||
}
|
||||
if got := tc.ad.ClickTrackable(); got != tc.trackable {
|
||||
t.Fatalf("ClickTrackable(%q, %d) = %v, want %v", tc.ad.ID, tc.ad.Location, got, tc.trackable)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user