@@ -22,73 +22,6 @@ describe('PushSubscription', () => {
2222 expect ( pushSubscription ) . toBeInstanceOf ( PushSubscription ) ;
2323 } ) ;
2424
25- describe ( 'id (deprecated)' , ( ) => {
26- test ( 'should set id via getPushSubscriptionId' , async ( ) => {
27- mockPlugin . getPushSubscriptionId . mockResolvedValue ( { id : SUB_ID } ) ;
28- pushSubscription . _setPropertiesAndObserver ( ) ;
29-
30- await vi . waitFor ( ( ) => {
31- expect ( pushSubscription . id ) . toBe ( SUB_ID ) ;
32- } ) ;
33- } ) ;
34-
35- test ( 'should set id via addEventListener' , ( ) => {
36- pushSubscription . _setPropertiesAndObserver ( ) ;
37-
38- const listener = mockPlugin . addListener . mock . calls . find (
39- ( call ) => call [ 0 ] === 'pushSubscriptionChange' ,
40- ) ?. [ 1 ] ;
41- listener ?.( { current : { id : SUB_ID , token : SUB_TOKEN , optedIn : true } } ) ;
42- expect ( pushSubscription . id ) . toBe ( SUB_ID ) ;
43- } ) ;
44- } ) ;
45-
46- describe ( 'token (deprecated)' , ( ) => {
47- test ( 'should set token via getPushSubscriptionToken' , async ( ) => {
48- mockPlugin . getPushSubscriptionToken . mockResolvedValue ( {
49- token : SUB_TOKEN ,
50- } ) ;
51- pushSubscription . _setPropertiesAndObserver ( ) ;
52-
53- await vi . waitFor ( ( ) => {
54- expect ( pushSubscription . token ) . toBe ( SUB_TOKEN ) ;
55- } ) ;
56- } ) ;
57-
58- test ( 'should set token via addEventListener' , ( ) => {
59- pushSubscription . _setPropertiesAndObserver ( ) ;
60-
61- const listener = mockPlugin . addListener . mock . calls . find (
62- ( call ) => call [ 0 ] === 'pushSubscriptionChange' ,
63- ) ?. [ 1 ] ;
64- listener ?.( { current : { id : SUB_ID , token : SUB_TOKEN , optedIn : true } } ) ;
65- expect ( pushSubscription . token ) . toBe ( SUB_TOKEN ) ;
66- } ) ;
67- } ) ;
68-
69- describe ( 'optedIn (deprecated)' , ( ) => {
70- test ( 'should set optedIn via getPushSubscriptionOptedIn' , async ( ) => {
71- mockPlugin . getPushSubscriptionOptedIn . mockResolvedValue ( {
72- optedIn : true ,
73- } ) ;
74- pushSubscription . _setPropertiesAndObserver ( ) ;
75-
76- await vi . waitFor ( ( ) => {
77- expect ( pushSubscription . optedIn ) . toBe ( true ) ;
78- } ) ;
79- } ) ;
80-
81- test ( 'should set optedIn via addEventListener' , ( ) => {
82- pushSubscription . _setPropertiesAndObserver ( ) ;
83-
84- const listener = mockPlugin . addListener . mock . calls . find (
85- ( call ) => call [ 0 ] === 'pushSubscriptionChange' ,
86- ) ?. [ 1 ] ;
87- listener ?.( { current : { id : SUB_ID , token : SUB_TOKEN , optedIn : true } } ) ;
88- expect ( pushSubscription . optedIn ) . toBe ( true ) ;
89- } ) ;
90- } ) ;
91-
9225 describe ( 'getIdAsync' , ( ) => {
9326 test ( 'should return a Promise' , ( ) => {
9427 const promise = pushSubscription . getIdAsync ( ) ;
0 commit comments