forked from bsm/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bid_test.go
39 lines (33 loc) · 993 Bytes
/
bid_test.go
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
package openrtb
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Bid", func() {
var subject *Bid
BeforeEach(func() {
err := fixture("bid", &subject)
Expect(err).NotTo(HaveOccurred())
})
It("should parse correctly", func() {
Expect(subject).To(Equal(&Bid{
ID: "1",
ImpID: "1",
Price: 0.751371,
AdID: "52a5516d29e435137c6f6e74",
NURL: "http://ads.com/win/112770_1386565997?won=${AUCTION_PRICE}",
AdMarkup: "<html/>",
AdvDomain: []string{"ads.com"},
IURL: "http://ads.com/112770_1386565997.jpeg",
CampaignID: "52a5516d29e435137c6f6e74",
CreativeID: "52a5516d29e435137c6f6e74_1386565997",
DealID: "example_deal",
Attr: []int{},
}))
})
It("should validate", func() {
Expect((&Bid{}).Validate()).To(Equal(ErrInvalidBidNoID))
Expect((&Bid{ID: "BIDID"}).Validate()).To(Equal(ErrInvalidBidNoImpID))
Expect(subject.Validate()).NotTo(HaveOccurred())
})
})