Skip to content

Commit e3aac21

Browse files
committed
Use constants and remove magic numbers on tests
1 parent 0b6b116 commit e3aac21

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

audio_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ var _ = Describe("Audio", func() {
2222
MaxDuration: 30,
2323
Protocols: []int{AudioProtocolDAAST1, AudioProtocolDAAST1Wrapper},
2424
Sequence: 1,
25-
BAttr: []int{13, 14},
25+
BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert},
2626
MaxExtended: 30,
2727
MinBitrate: 300,
2828
MaxBitrate: 1500,
29-
Delivery: []int{2},
29+
Delivery: []int{ContentDeliveryProgressive},
3030
CompanionAd: []Banner{
31-
{W: 300, H: 250, ID: "1234567893-1", Pos: 1, BAttr: []int{13, 14}, ExpDir: []int{ExpDirRight, ExpDirDown}},
32-
{W: 728, H: 90, ID: "1234567893-2", Pos: 1, BAttr: []int{13, 14}},
31+
{W: 300, H: 250, ID: "1234567893-1", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}, ExpDir: []int{ExpDirRight, ExpDirDown}},
32+
{W: 728, H: 90, ID: "1234567893-2", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}},
3333
},
34-
API: []int{1, 2},
35-
CompanionType: []int{1, 2},
34+
API: []int{APIFrameworkVPAID1, APIFrameworkVPAID2},
35+
CompanionType: []int{VASTCompanionStatic, VASTCompanionHTML},
3636
}))
3737
})
3838

@@ -42,16 +42,16 @@ var _ = Describe("Audio", func() {
4242
MaxDuration: 30,
4343
Protocols: []int{AudioProtocolDAAST1, AudioProtocolDAAST1Wrapper},
4444
Sequence: 1,
45-
BAttr: []int{13, 14},
45+
BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert},
4646
MaxExtended: 30,
4747
MinBitrate: 300,
4848
MaxBitrate: 1500,
49-
Delivery: []int{2},
49+
Delivery: []int{ContentDeliveryProgressive},
5050
CompanionAd: []Banner{
51-
{W: 300, H: 250, ID: "1234567893-1", Pos: 1, BAttr: []int{13, 14}, ExpDir: []int{ExpDirRight, ExpDirDown}},
52-
{W: 728, H: 90, ID: "1234567893-2", Pos: 1, BAttr: []int{13, 14}},
51+
{W: 300, H: 250, ID: "1234567893-1", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}, ExpDir: []int{ExpDirRight, ExpDirDown}},
52+
{W: 728, H: 90, ID: "1234567893-2", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}},
5353
},
54-
CompanionType: []int{1, 2},
54+
CompanionType: []int{VASTCompanionStatic, VASTCompanionHTML},
5555
}).Validate()).To(Equal(ErrInvalidAudioNoMimes))
5656
})
5757

bidrequest_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ var _ = Describe("BidRequest", func() {
3030
{
3131
ID: "1",
3232
Secure: json.Number("1"),
33-
Banner: &Banner{W: 300, H: 250, Pos: AdPosAboveFold, BAttr: []int{13}},
33+
Banner: &Banner{W: 300, H: 250, Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated}},
3434
},
3535
},
3636
Site: &Site{

device_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ var _ = Describe("Device", func() {
3636
OS: "iOS",
3737
OSVer: "6.1",
3838
JS: 1,
39-
ConnType: 3,
40-
DeviceType: 1,
39+
ConnType: ConnTypeCell,
40+
DeviceType: DeviceTypeMobile,
4141
}))
4242
})
4343
})

native/request/request_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var _ = Describe("Request", func() {
2424
{ID: 128, Image: &Image{TypeID: ImageTypeMain, WidthMin: 836, HeightMin: 627, Width: 1000, Height: 800, Mimes: []string{"image/jpg"}}},
2525
{ID: 126, Required: 1, Data: &Data{TypeID: DataTypeSponsored, Length: 25}},
2626
{ID: 127, Required: 1, Data: &Data{TypeID: DataTypeDesc, Length: 140}},
27-
{ID: 4, Video: &Video{MinDuration: 15, MaxDuration: 30, Protocols: []int{2, 3}, Mimes: []string{"video/mp4"}}},
27+
{ID: 4, Video: &Video{MinDuration: 15, MaxDuration: 30, Protocols: []int{VideoProtoVAST2, VideoProtoVAST3}, Mimes: []string{"video/mp4"}}},
2828
},
2929
}))
3030
})

video_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ var _ = Describe("Video", func() {
2828
H: 480,
2929
Linearity: VideoLinearityLinear,
3030
Sequence: 1,
31-
BAttr: []int{13, 14},
31+
BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert},
3232
MaxExtended: 30,
3333
MinBitrate: 300,
3434
MaxBitrate: 1500,
3535
BoxingAllowed: iptr(1),
3636
PlaybackMethod: []int{VideoPlaybackAutoSoundOn, VideoPlaybackClickToPlay},
37-
Delivery: []int{2},
37+
Delivery: []int{ContentDeliveryProgressive},
3838
Pos: AdPosAboveFold,
3939
CompanionAd: []Banner{
40-
{W: 300, H: 250, ID: "1234567893-1", Pos: 1, BAttr: []int{13, 14}, ExpDir: []int{ExpDirRight, ExpDirDown}},
41-
{W: 728, H: 90, ID: "1234567893-2", Pos: 1, BAttr: []int{13, 14}},
40+
{W: 300, H: 250, ID: "1234567893-1", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}, ExpDir: []int{ExpDirRight, ExpDirDown}},
41+
{W: 728, H: 90, ID: "1234567893-2", Pos: AdPosAboveFold, BAttr: []int{CreativeAttributeUserInitiated, CreativeAttributeWindowsDialogOrAlert}},
4242
},
43-
Api: []int{1, 2},
44-
CompanionType: []int{1, 2},
43+
Api: []int{APIFrameworkVPAID1, APIFrameworkVPAID2},
44+
CompanionType: []int{VASTCompanionStatic, VASTCompanionHTML},
4545
}))
4646
})
4747

0 commit comments

Comments
 (0)