forked from bsm/openrtb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
audio_test.go
58 lines (52 loc) · 2.03 KB
/
audio_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package openrtb
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Audio", func() {
var subject *Audio
BeforeEach(func() {
err := fixture("audio", &subject)
Expect(err).NotTo(HaveOccurred())
})
It("should parse correctly", func() {
Expect(subject).To(Equal(&Audio{
Mimes: []string{
"audio/mp4",
},
MinDuration: 5,
MaxDuration: 30,
Protocols: []int{AudioProtocolDAAST1, AudioProtocolDAAST1Wrapper},
Sequence: 1,
BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert},
MaxExtended: 30,
MinBitrate: 300,
MaxBitrate: 1500,
Delivery: []int{ContentDeliveryProgressive},
CompanionAd: []Banner{
{W: 300, H: 250, ID: "1234567893-1", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}, ExpDir: []int{ExpDirRight, ExpDirDown}},
{W: 728, H: 90, ID: "1234567893-2", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}},
},
API: []int{APIFrameworkVPAID1, APIFrameworkVPAID2},
CompanionType: []int{VASTCompanionStatic, VASTCompanionHTML},
}))
})
It("should validate", func() {
Expect((&Audio{
MinDuration: 5,
MaxDuration: 30,
Protocols: []int{AudioProtocolDAAST1, AudioProtocolDAAST1Wrapper},
Sequence: 1,
BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert},
MaxExtended: 30,
MinBitrate: 300,
MaxBitrate: 1500,
Delivery: []int{ContentDeliveryProgressive},
CompanionAd: []Banner{
{W: 300, H: 250, ID: "1234567893-1", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}, ExpDir: []int{ExpDirRight, ExpDirDown}},
{W: 728, H: 90, ID: "1234567893-2", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}},
},
CompanionType: []int{VASTCompanionStatic, VASTCompanionHTML},
}).Validate()).To(Equal(ErrInvalidAudioNoMimes))
})
})