@@ -22,7 +22,6 @@ @implementation PushMobileTests
22
22
- (void )testHandlePushStringAlert {
23
23
id mockedUtils = PFStrictProtocolMock (@protocol (PFPushInternalUtils));
24
24
OCMExpect ([mockedUtils showAlertViewWithTitle: [OCMArg isNil ] message: @" hello" ]);
25
- OCMExpect ([mockedUtils playVibrate ]);
26
25
27
26
// NOTE: Async parse preload step may call this selector.
28
27
// Don't epxect it because it doesn't ALWAYs get to this point before returning from the method.
@@ -39,7 +38,6 @@ - (void)testHandlePushStringAlert {
39
38
- (void )testHandlePushDictionaryAlert {
40
39
id mockedUtils = PFStrictProtocolMock (@protocol (PFPushInternalUtils));
41
40
OCMExpect ([mockedUtils showAlertViewWithTitle: [OCMArg isNil ] message: @" hello bob 1" ]);
42
- OCMExpect ([mockedUtils playVibrate ]);
43
41
44
42
// NOTE: Async parse preload step may call this selector.
45
43
// Don't epxect it because it doesn't ALWAYs get to this point before returning from the method.
@@ -57,7 +55,6 @@ - (void)testHandlePushDictionaryAlert {
57
55
- (void )testHandlePushWithNullSound {
58
56
id mockedUtils = PFStrictProtocolMock (@protocol (PFPushInternalUtils));
59
57
OCMExpect ([mockedUtils showAlertViewWithTitle: [OCMArg isNil ] message: @" hello" ]);
60
- OCMExpect ([mockedUtils playVibrate ]);
61
58
62
59
// NOTE: Async parse preload step may call this selector.
63
60
// Don't epxect it because it doesn't ALWAYs get to this point before returning from the method.
@@ -71,4 +68,37 @@ - (void)testHandlePushWithNullSound {
71
68
[PFPush setPushInternalUtilClass: nil ];
72
69
}
73
70
71
+ - (void )testHandlePushWithDefaultSound {
72
+ id mockedUtils = PFStrictProtocolMock (@protocol (PFPushInternalUtils));
73
+ OCMExpect ([mockedUtils showAlertViewWithTitle: [OCMArg isNil ] message: @" hello" ]);
74
+ OCMExpect ([mockedUtils playVibrate ]);
75
+
76
+ // NOTE: Async parse preload step may call this selector.
77
+ // Don't epxect it because it doesn't ALWAYs get to this point before returning from the method.
78
+ OCMStub ([mockedUtils getDeviceTokenFromKeychain ]).andReturn (nil );
79
+
80
+ [PFPush setPushInternalUtilClass: mockedUtils];
81
+ [PFPush handlePush: @{ @" aps" : @{@" alert" : @" hello" , @" sound" : @" default" } }];
82
+
83
+ OCMVerifyAll (mockedUtils);
84
+
85
+ [PFPush setPushInternalUtilClass: nil ];
86
+ }
87
+
88
+ - (void )testHandlePushWithCustomSound {
89
+ id mockedUtils = PFStrictProtocolMock (@protocol (PFPushInternalUtils));
90
+ OCMExpect ([mockedUtils playAudioWithName: @" yolo" ]);
91
+
92
+ // NOTE: Async parse preload step may call this selector.
93
+ // Don't epxect it because it doesn't ALWAYs get to this point before returning from the method.
94
+ OCMStub ([mockedUtils getDeviceTokenFromKeychain ]).andReturn (nil );
95
+
96
+ [PFPush setPushInternalUtilClass: mockedUtils];
97
+ [PFPush handlePush: @{ @" aps" : @{@" sound" : @" yolo" } }];
98
+
99
+ OCMVerifyAll (mockedUtils);
100
+
101
+ [PFPush setPushInternalUtilClass: nil ];
102
+ }
103
+
74
104
@end
0 commit comments