@@ -20,17 +20,17 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
20
20
mockInnerTransport . mockResolvedValue ( expectedDataPublisher ) ;
21
21
const config = {
22
22
executeSubscriptionPlan : jest . fn ( ) ,
23
+ request : { methodName : 'foo' , params : [ ] } ,
23
24
signal : new AbortController ( ) . signal ,
24
- subscriptionConfigurationHash : 'MOCK_HASH' ,
25
25
} ;
26
26
const transportPromise = coalescedTransport ( config ) ;
27
27
await expect ( transportPromise ) . resolves . toBe ( expectedDataPublisher ) ;
28
28
} ) ;
29
29
it ( 'passes the `executeSubscriptionPlan` config to the inner transport' , ( ) => {
30
30
const config = {
31
31
executeSubscriptionPlan : jest . fn ( ) ,
32
+ request : { methodName : 'foo' , params : [ ] } ,
32
33
signal : new AbortController ( ) . signal ,
33
- subscriptionConfigurationHash : 'MOCK_HASH' ,
34
34
} ;
35
35
coalescedTransport ( config ) . catch ( ( ) => { } ) ;
36
36
expect ( mockInnerTransport ) . toHaveBeenCalledWith (
@@ -39,16 +39,16 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
39
39
} ) ,
40
40
) ;
41
41
} ) ;
42
- it ( 'passes the `subscriptionConfigurationHash ` config to the inner transport' , ( ) => {
42
+ it ( 'passes the `rpcRequest ` config to the inner transport' , ( ) => {
43
43
const config = {
44
44
executeSubscriptionPlan : jest . fn ( ) ,
45
+ request : { methodName : 'foo' , params : [ ] } ,
45
46
signal : new AbortController ( ) . signal ,
46
- subscriptionConfigurationHash : 'MOCK_HASH' ,
47
47
} ;
48
48
coalescedTransport ( config ) . catch ( ( ) => { } ) ;
49
49
expect ( mockInnerTransport ) . toHaveBeenCalledWith (
50
50
expect . objectContaining ( {
51
- subscriptionConfigurationHash : 'MOCK_HASH' ,
51
+ request : { methodName : 'foo' , params : [ ] } ,
52
52
} ) ,
53
53
) ;
54
54
} ) ;
@@ -58,11 +58,11 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
58
58
signal : new AbortController ( ) . signal ,
59
59
} ;
60
60
coalescedTransport ( {
61
- subscriptionConfigurationHash : 'MOCK_HASH_A' ,
61
+ request : { methodName : 'methodA' , params : [ ] } ,
62
62
...config ,
63
63
} ) . catch ( ( ) => { } ) ;
64
64
coalescedTransport ( {
65
- subscriptionConfigurationHash : 'MOCK_HASH_B' ,
65
+ request : { methodName : 'methodB' , params : [ ] } ,
66
66
...config ,
67
67
} ) . catch ( ( ) => { } ) ;
68
68
expect ( mockInnerTransport ) . toHaveBeenCalledTimes ( 2 ) ;
@@ -73,46 +73,15 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
73
73
executeSubscriptionPlan : jest . fn ( ) ,
74
74
signal : new AbortController ( ) . signal ,
75
75
} ;
76
- await coalescedTransport ( { ...config , subscriptionConfigurationHash : 'MOCK_HASH_A' } ) ;
77
- await coalescedTransport ( { ...config , subscriptionConfigurationHash : 'MOCK_HASH_B' } ) ;
78
- expect ( mockInnerTransport ) . toHaveBeenCalledTimes ( 2 ) ;
79
- } ) ;
80
- it ( "calls the inner transport once per subscriber when both subscribers' hashes are `undefined`, in the same runloop" , ( ) => {
81
- const config = {
82
- executeSubscriptionPlan : jest . fn ( ) ,
83
- signal : new AbortController ( ) . signal ,
84
- } ;
85
- coalescedTransport ( {
86
- subscriptionConfigurationHash : undefined ,
87
- ...config ,
88
- } ) . catch ( ( ) => { } ) ;
89
- coalescedTransport ( {
90
- subscriptionConfigurationHash : undefined ,
91
- ...config ,
92
- } ) . catch ( ( ) => { } ) ;
93
- expect ( mockInnerTransport ) . toHaveBeenCalledTimes ( 2 ) ;
94
- } ) ;
95
- it ( "calls the inner transport once per subscriber when both subscribers' hashes are `undefined`, in different runloops" , async ( ) => {
96
- expect . assertions ( 1 ) ;
97
- const config = {
98
- executeSubscriptionPlan : jest . fn ( ) ,
99
- signal : new AbortController ( ) . signal ,
100
- } ;
101
- await coalescedTransport ( {
102
- subscriptionConfigurationHash : undefined ,
103
- ...config ,
104
- } ) ;
105
- await coalescedTransport ( {
106
- subscriptionConfigurationHash : undefined ,
107
- ...config ,
108
- } ) ;
76
+ await coalescedTransport ( { ...config , request : { methodName : 'methodA' , params : [ ] } } ) ;
77
+ await coalescedTransport ( { ...config , request : { methodName : 'methodB' , params : [ ] } } ) ;
109
78
expect ( mockInnerTransport ) . toHaveBeenCalledTimes ( 2 ) ;
110
79
} ) ;
111
80
it ( 'only calls the inner transport once, in the same runloop' , ( ) => {
112
81
const config = {
113
82
executeSubscriptionPlan : jest . fn ( ) ,
83
+ request : { methodName : 'foo' , params : [ ] } ,
114
84
signal : new AbortController ( ) . signal ,
115
- subscriptionConfigurationHash : 'MOCK_HASH' ,
116
85
} ;
117
86
coalescedTransport ( config ) . catch ( ( ) => { } ) ;
118
87
coalescedTransport ( config ) . catch ( ( ) => { } ) ;
@@ -122,8 +91,8 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
122
91
expect . assertions ( 1 ) ;
123
92
const config = {
124
93
executeSubscriptionPlan : jest . fn ( ) ,
94
+ request : { methodName : 'foo' , params : [ ] } ,
125
95
signal : new AbortController ( ) . signal ,
126
- subscriptionConfigurationHash : 'MOCK_HASH' ,
127
96
} ;
128
97
await coalescedTransport ( config ) ;
129
98
await coalescedTransport ( config ) ;
@@ -133,8 +102,8 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
133
102
expect . assertions ( 1 ) ;
134
103
const config = {
135
104
executeSubscriptionPlan : jest . fn ( ) ,
105
+ request : { methodName : 'foo' , params : [ ] } ,
136
106
signal : new AbortController ( ) . signal ,
137
- subscriptionConfigurationHash : 'MOCK_HASH' ,
138
107
} ;
139
108
const [ publisherA , publisherB ] = await Promise . all ( [ coalescedTransport ( config ) , coalescedTransport ( config ) ] ) ;
140
109
expect ( publisherA ) . toBe ( publisherB ) ;
@@ -143,8 +112,8 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
143
112
expect . assertions ( 1 ) ;
144
113
const config = {
145
114
executeSubscriptionPlan : jest . fn ( ) ,
115
+ request : { methodName : 'foo' , params : [ ] } ,
146
116
signal : new AbortController ( ) . signal ,
147
- subscriptionConfigurationHash : 'MOCK_HASH' ,
148
117
} ;
149
118
const publisherA = await coalescedTransport ( config ) ;
150
119
const publisherB = await coalescedTransport ( config ) ;
@@ -154,7 +123,7 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
154
123
jest . useFakeTimers ( ) ;
155
124
const config = {
156
125
executeSubscriptionPlan : jest . fn ( ) ,
157
- subscriptionConfigurationHash : 'MOCK_HASH' ,
126
+ request : { methodName : 'foo' , params : [ ] } ,
158
127
} ;
159
128
const abortControllerB = new AbortController ( ) ;
160
129
coalescedTransport ( { ...config , signal : new AbortController ( ) . signal } ) . catch ( ( ) => { } ) ;
@@ -167,7 +136,7 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
167
136
jest . useFakeTimers ( ) ;
168
137
const config = {
169
138
executeSubscriptionPlan : jest . fn ( ) ,
170
- subscriptionConfigurationHash : 'MOCK_HASH' ,
139
+ request : { methodName : 'foo' , params : [ ] } ,
171
140
} ;
172
141
const abortControllerA = new AbortController ( ) ;
173
142
const abortControllerB = new AbortController ( ) ;
@@ -182,7 +151,7 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
182
151
expect . assertions ( 1 ) ;
183
152
const config = {
184
153
executeSubscriptionPlan : jest . fn ( ) ,
185
- subscriptionConfigurationHash : 'MOCK_HASH' ,
154
+ request : { methodName : 'foo' , params : [ ] } ,
186
155
} ;
187
156
const abortControllerA = new AbortController ( ) ;
188
157
const abortControllerB = new AbortController ( ) ;
@@ -198,7 +167,7 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
198
167
it ( 'does not fire the inner abort signal if the subscriber count is non zero at the end of the runloop, despite having aborted all in the middle of it' , ( ) => {
199
168
const config = {
200
169
executeSubscriptionPlan : jest . fn ( ) ,
201
- subscriptionConfigurationHash : 'MOCK_HASH' ,
170
+ request : { methodName : 'foo' , params : [ ] } ,
202
171
} ;
203
172
const abortControllerA = new AbortController ( ) ;
204
173
coalescedTransport ( { ...config , signal : abortControllerA . signal } ) . catch ( ( ) => { } ) ;
@@ -212,7 +181,7 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
212
181
jest . useFakeTimers ( ) ;
213
182
const config = {
214
183
executeSubscriptionPlan : jest . fn ( ) ,
215
- subscriptionConfigurationHash : 'MOCK_HASH' ,
184
+ request : { methodName : 'foo' , params : [ ] } ,
216
185
} ;
217
186
coalescedTransport ( { ...config , signal : new AbortController ( ) . signal } ) . catch ( ( ) => { } ) ;
218
187
await jest . runAllTimersAsync ( ) ;
@@ -225,7 +194,7 @@ describe('getRpcSubscriptionsTransportWithSubscriptionCoalescing', () => {
225
194
jest . useFakeTimers ( ) ;
226
195
const config = {
227
196
executeSubscriptionPlan : jest . fn ( ) ,
228
- subscriptionConfigurationHash : 'MOCK_HASH' ,
197
+ request : { methodName : 'foo' , params : [ ] } ,
229
198
} ;
230
199
const abortControllerA = new AbortController ( ) ;
231
200
/**
0 commit comments