@@ -185,6 +185,64 @@ void main() {
185185 expect (await return2, result1);
186186 });
187187
188+ test ("does not dedupe identical mutations" , () async {
189+ final document = parseString (
190+ """
191+ mutation withVar(\$ i: Int) {
192+ take(i: \$ i)
193+ }
194+ """ ,
195+ );
196+
197+ final req1 = Request (
198+ operation: Operation (
199+ document: document,
200+ ),
201+ variables: const < String , dynamic > {"i" : 12 },
202+ );
203+
204+ final req2 = Request (
205+ operation: Operation (
206+ document: document,
207+ ),
208+ variables: const < String , dynamic > {"i" : 12 },
209+ );
210+
211+ const result1Data = < String , dynamic > {"a" : 1 };
212+ final result1 = Response (
213+ data: result1Data,
214+ response: const < String , dynamic > {"data" : result1Data},
215+ );
216+
217+ final mockLink = MockLink ();
218+
219+ when (
220+ mockLink.request (req1, null ),
221+ ).thenAnswer (
222+ (_) => Stream .fromIterable ([result1]),
223+ );
224+
225+ when (
226+ mockLink.request (req2, null ),
227+ ).thenAnswer (
228+ (_) => Stream .fromIterable ([result1]),
229+ );
230+
231+ final link = Link .from ([
232+ DedupeLink (),
233+ mockLink,
234+ ]);
235+
236+ final stream1 = link.request (req1);
237+ final stream2 = link.request (req2);
238+
239+ verify (
240+ mockLink.request (req1, null ),
241+ ).called (2 );
242+ expect (await stream1.first, result1);
243+ expect (await stream2.first, result1);
244+ });
245+
188246 test (
189247 "does not dedupe identical queries if shouldDedupe is false for request" ,
190248 () async {
0 commit comments