forked from Unity-Technologies/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimpression_test.go
More file actions
55 lines (49 loc) · 1.08 KB
/
Copy pathimpression_test.go
File metadata and controls
55 lines (49 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package openrtb
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Impression", func() {
var subject *Impression
BeforeEach(func() {
err := fixture("impression", &subject)
Expect(err).NotTo(HaveOccurred())
})
It("should parse correctly", func() {
Expect(subject).To(Equal(&Impression{
ID: "1",
Metric: []*Metric{
{
Type: "viewable_percentage_1",
Value: 0.99,
Vendor: "MOAT",
},
{
Type: "viewable_percentage_2",
Value: 0.98,
Vendor: "MOAT",
},
},
Banner: &Banner{
W: 300,
H: 250,
},
BidFloor: 0.03,
Pmp: &Pmp{
Private: 1,
Deals: []Deal{
{
ID: "DX-1985-010A",
BidFloor: 2.5,
AuctionType: 2,
},
},
},
}))
})
It("should validate", func() {
Expect((&Impression{}).Validate()).To(Equal(ErrInvalidImpNoID))
Expect((&Impression{ID: "IMPID", Banner: &Banner{}, Video: &Video{}}).Validate()).To(Equal(ErrInvalidImpMultiAssets))
Expect((&Impression{ID: "IMPID", Banner: &Banner{}}).Validate()).NotTo(HaveOccurred())
})
})