@@ -170,7 +170,6 @@ TEST_F(TodayServiceCase, QueryEverything)
170
170
171
171
TEST_F (TodayServiceCase, QueryEverythingWithPegtl)
172
172
{
173
- const char * error = nullptr ;
174
173
auto ast = service::parseString (R"gql(
175
174
query Everything {
176
175
appointments {
@@ -202,13 +201,6 @@ TEST_F(TodayServiceCase, QueryEverythingWithPegtl)
202
201
}
203
202
}
204
203
})gql" );
205
- EXPECT_EQ (nullptr , error) << error;
206
- if (nullptr != error)
207
- {
208
- free (const_cast <char *>(error));
209
- return ;
210
- }
211
-
212
204
auto result = _service->resolve (*ast, " Everything" , web::json::value::object ().as_object ());
213
205
EXPECT_EQ (1 , _getAppointmentsCount) << " today service lazy loads the appointments and caches the result" ;
214
206
EXPECT_EQ (1 , _getTasksCount) << " today service lazy loads the tasks and caches the result" ;
@@ -225,38 +217,38 @@ TEST_F(TodayServiceCase, QueryEverythingWithPegtl)
225
217
errors << errorsItr->second ;
226
218
FAIL () << utility::conversions::to_utf8string (errors.str ());
227
219
}
228
- auto data = service::ScalarArgument<> ::require (" data" , result.as_object ());
220
+ auto data = service::ScalarArgument::require (" data" , result.as_object ());
229
221
230
- auto appointmentEdges = service::ScalarArgument<service::TypeModifier::List>:: require (" edges" ,
231
- service::ScalarArgument<> ::require (" appointments" , data.as_object ()).as_object ());
222
+ auto appointmentEdges = service::ScalarArgument::require <service::TypeModifier::List>(" edges" ,
223
+ service::ScalarArgument::require (" appointments" , data.as_object ()).as_object ());
232
224
ASSERT_EQ (1 , appointmentEdges.size ()) << " appointments should have 1 entry" ;
233
225
ASSERT_TRUE (appointmentEdges[0 ].is_object ()) << " appointment should be an object" ;
234
- auto appointmentNode = service::ScalarArgument<> ::require (" node" , appointmentEdges[0 ].as_object ());
226
+ auto appointmentNode = service::ScalarArgument::require (" node" , appointmentEdges[0 ].as_object ());
235
227
const web::json::object& appointment = appointmentNode.as_object ();
236
- EXPECT_EQ (_fakeAppointmentId, service::IdArgument<> ::require (" id" , appointment)) << " id should match in base64 encoding" ;
237
- EXPECT_EQ (" Lunch?" , service::StringArgument<> ::require (" subject" , appointment)) << " subject should match" ;
238
- EXPECT_EQ (" tomorrow" , service::StringArgument<> ::require (" when" , appointment)) << " when should match" ;
239
- EXPECT_FALSE (service::BooleanArgument<> ::require (" isNow" , appointment)) << " isNow should match" ;
228
+ EXPECT_EQ (_fakeAppointmentId, service::IdArgument::require (" id" , appointment)) << " id should match in base64 encoding" ;
229
+ EXPECT_EQ (" Lunch?" , service::StringArgument::require (" subject" , appointment)) << " subject should match" ;
230
+ EXPECT_EQ (" tomorrow" , service::StringArgument::require (" when" , appointment)) << " when should match" ;
231
+ EXPECT_FALSE (service::BooleanArgument::require (" isNow" , appointment)) << " isNow should match" ;
240
232
241
- auto taskEdges = service::ScalarArgument<service::TypeModifier::List>:: require (" edges" ,
242
- service::ScalarArgument<> ::require (" tasks" , data.as_object ()).as_object ());
233
+ auto taskEdges = service::ScalarArgument::require <service::TypeModifier::List>(" edges" ,
234
+ service::ScalarArgument::require (" tasks" , data.as_object ()).as_object ());
243
235
ASSERT_EQ (1 , taskEdges.size ()) << " tasks should have 1 entry" ;
244
236
ASSERT_TRUE (taskEdges[0 ].is_object ()) << " task should be an object" ;
245
- auto taskNode = service::ScalarArgument<> ::require (" node" , taskEdges[0 ].as_object ());
237
+ auto taskNode = service::ScalarArgument::require (" node" , taskEdges[0 ].as_object ());
246
238
const web::json::object& task = taskNode.as_object ();
247
- EXPECT_EQ (_fakeTaskId, service::IdArgument<> ::require (" id" , task)) << " id should match in base64 encoding" ;
248
- EXPECT_EQ (" Don't forget" , service::StringArgument<> ::require (" title" , task)) << " title should match" ;
249
- EXPECT_TRUE (service::BooleanArgument<> ::require (" isComplete" , task)) << " isComplete should match" ;
239
+ EXPECT_EQ (_fakeTaskId, service::IdArgument::require (" id" , task)) << " id should match in base64 encoding" ;
240
+ EXPECT_EQ (" Don't forget" , service::StringArgument::require (" title" , task)) << " title should match" ;
241
+ EXPECT_TRUE (service::BooleanArgument::require (" isComplete" , task)) << " isComplete should match" ;
250
242
251
- auto unreadCountEdges = service::ScalarArgument<service::TypeModifier::List>:: require (" edges" ,
252
- service::ScalarArgument<> ::require (" unreadCounts" , data.as_object ()).as_object ());
243
+ auto unreadCountEdges = service::ScalarArgument::require <service::TypeModifier::List>(" edges" ,
244
+ service::ScalarArgument::require (" unreadCounts" , data.as_object ()).as_object ());
253
245
ASSERT_EQ (1 , unreadCountEdges.size ()) << " unreadCounts should have 1 entry" ;
254
246
ASSERT_TRUE (unreadCountEdges[0 ].is_object ()) << " unreadCount should be an object" ;
255
- auto unreadCountNode = service::ScalarArgument<> ::require (" node" , unreadCountEdges[0 ].as_object ());
247
+ auto unreadCountNode = service::ScalarArgument::require (" node" , unreadCountEdges[0 ].as_object ());
256
248
const web::json::object& folder = unreadCountNode.as_object ();
257
- EXPECT_EQ (_fakeFolderId, service::IdArgument<> ::require (" id" , folder)) << " id should match in base64 encoding" ;
258
- EXPECT_EQ (" \" Fake\" Inbox" , service::StringArgument<> ::require (" name" , folder)) << " name should match" ;
259
- EXPECT_EQ (3 , service::IntArgument<> ::require (" unreadCount" , folder)) << " isComplete should match" ;
249
+ EXPECT_EQ (_fakeFolderId, service::IdArgument::require (" id" , folder)) << " id should match in base64 encoding" ;
250
+ EXPECT_EQ (" \" Fake\" Inbox" , service::StringArgument::require (" name" , folder)) << " name should match" ;
251
+ EXPECT_EQ (3 , service::IntArgument::require (" unreadCount" , folder)) << " isComplete should match" ;
260
252
}
261
253
catch (const service::schema_exception& ex)
262
254
{
@@ -341,7 +333,6 @@ TEST_F(TodayServiceCase, QueryAppointmentsWithPegtl)
341
333
}
342
334
}
343
335
})gql" );
344
-
345
336
auto result = _service->resolve (*ast, " " , web::json::value::object ().as_object ());
346
337
EXPECT_EQ (1 , _getAppointmentsCount) << " today service lazy loads the appointments and caches the result" ;
347
338
EXPECT_GE (1 , _getTasksCount) << " today service lazy loads the tasks and caches the result" ;
@@ -358,18 +349,18 @@ TEST_F(TodayServiceCase, QueryAppointmentsWithPegtl)
358
349
errors << errorsItr->second ;
359
350
FAIL () << utility::conversions::to_utf8string (errors.str ());
360
351
}
361
- auto data = service::ScalarArgument<> ::require (" data" , result.as_object ());
352
+ auto data = service::ScalarArgument::require (" data" , result.as_object ());
362
353
363
- auto appointmentEdges = service::ScalarArgument<service::TypeModifier::List>:: require (" edges" ,
364
- service::ScalarArgument<> ::require (" appointments" , data.as_object ()).as_object ());
354
+ auto appointmentEdges = service::ScalarArgument::require <service::TypeModifier::List>(" edges" ,
355
+ service::ScalarArgument::require (" appointments" , data.as_object ()).as_object ());
365
356
ASSERT_EQ (1 , appointmentEdges.size ()) << " appointments should have 1 entry" ;
366
357
ASSERT_TRUE (appointmentEdges[0 ].is_object ()) << " appointment should be an object" ;
367
- auto appointmentNode = service::ScalarArgument<> ::require (" node" , appointmentEdges[0 ].as_object ());
358
+ auto appointmentNode = service::ScalarArgument::require (" node" , appointmentEdges[0 ].as_object ());
368
359
const web::json::object& appointment = appointmentNode.as_object ();
369
- EXPECT_EQ (_fakeAppointmentId, service::IdArgument<> ::require (" appointmentId" , appointment)) << " id should match in base64 encoding" ;
370
- EXPECT_EQ (" Lunch?" , service::StringArgument<> ::require (" subject" , appointment)) << " subject should match" ;
371
- EXPECT_EQ (" tomorrow" , service::StringArgument<> ::require (" when" , appointment)) << " when should match" ;
372
- EXPECT_FALSE (service::BooleanArgument<> ::require (" isNow" , appointment)) << " isNow should match" ;
360
+ EXPECT_EQ (_fakeAppointmentId, service::IdArgument::require (" appointmentId" , appointment)) << " id should match in base64 encoding" ;
361
+ EXPECT_EQ (" Lunch?" , service::StringArgument::require (" subject" , appointment)) << " subject should match" ;
362
+ EXPECT_EQ (" tomorrow" , service::StringArgument::require (" when" , appointment)) << " when should match" ;
363
+ EXPECT_FALSE (service::BooleanArgument::require (" isNow" , appointment)) << " isNow should match" ;
373
364
}
374
365
catch (const service::schema_exception& ex)
375
366
{
@@ -451,7 +442,6 @@ TEST_F(TodayServiceCase, QueryTasksWithPegtl)
451
442
}
452
443
}
453
444
})gql" );
454
-
455
445
auto result = _service->resolve (*ast, " " , web::json::value::object ().as_object ());
456
446
EXPECT_GE (1 , _getAppointmentsCount) << " today service lazy loads the appointments and caches the result" ;
457
447
EXPECT_EQ (1 , _getTasksCount) << " today service lazy loads the tasks and caches the result" ;
@@ -468,17 +458,17 @@ TEST_F(TodayServiceCase, QueryTasksWithPegtl)
468
458
errors << errorsItr->second ;
469
459
FAIL () << utility::conversions::to_utf8string (errors.str ());
470
460
}
471
- auto data = service::ScalarArgument<> ::require (" data" , result.as_object ());
461
+ auto data = service::ScalarArgument::require (" data" , result.as_object ());
472
462
473
- auto taskEdges = service::ScalarArgument<service::TypeModifier::List>:: require (" edges" ,
474
- service::ScalarArgument<> ::require (" tasks" , data.as_object ()).as_object ());
463
+ auto taskEdges = service::ScalarArgument::require <service::TypeModifier::List>(" edges" ,
464
+ service::ScalarArgument::require (" tasks" , data.as_object ()).as_object ());
475
465
ASSERT_EQ (1 , taskEdges.size ()) << " tasks should have 1 entry" ;
476
466
ASSERT_TRUE (taskEdges[0 ].is_object ()) << " task should be an object" ;
477
- auto taskNode = service::ScalarArgument<> ::require (" node" , taskEdges[0 ].as_object ());
467
+ auto taskNode = service::ScalarArgument::require (" node" , taskEdges[0 ].as_object ());
478
468
const web::json::object& task = taskNode.as_object ();
479
- EXPECT_EQ (_fakeTaskId, service::IdArgument<> ::require (" taskId" , task)) << " id should match in base64 encoding" ;
480
- EXPECT_EQ (" Don't forget" , service::StringArgument<> ::require (" title" , task)) << " title should match" ;
481
- EXPECT_TRUE (service::BooleanArgument<> ::require (" isComplete" , task)) << " isComplete should match" ;
469
+ EXPECT_EQ (_fakeTaskId, service::IdArgument::require (" taskId" , task)) << " id should match in base64 encoding" ;
470
+ EXPECT_EQ (" Don't forget" , service::StringArgument::require (" title" , task)) << " title should match" ;
471
+ EXPECT_TRUE (service::BooleanArgument::require (" isComplete" , task)) << " isComplete should match" ;
482
472
}
483
473
catch (const service::schema_exception& ex)
484
474
{
@@ -560,7 +550,6 @@ TEST_F(TodayServiceCase, QueryUnreadCountsWithPegtl)
560
550
}
561
551
}
562
552
})gql" );
563
-
564
553
auto result = _service->resolve (*ast, " " , web::json::value::object ().as_object ());
565
554
EXPECT_GE (1 , _getAppointmentsCount) << " today service lazy loads the appointments and caches the result" ;
566
555
EXPECT_GE (1 , _getTasksCount) << " today service lazy loads the tasks and caches the result" ;
@@ -577,17 +566,17 @@ TEST_F(TodayServiceCase, QueryUnreadCountsWithPegtl)
577
566
errors << errorsItr->second ;
578
567
FAIL () << utility::conversions::to_utf8string (errors.str ());
579
568
}
580
- auto data = service::ScalarArgument<> ::require (" data" , result.as_object ());
569
+ auto data = service::ScalarArgument::require (" data" , result.as_object ());
581
570
582
- auto unreadCountEdges = service::ScalarArgument<service::TypeModifier::List>:: require (" edges" ,
583
- service::ScalarArgument<> ::require (" unreadCounts" , data.as_object ()).as_object ());
571
+ auto unreadCountEdges = service::ScalarArgument::require <service::TypeModifier::List>(" edges" ,
572
+ service::ScalarArgument::require (" unreadCounts" , data.as_object ()).as_object ());
584
573
ASSERT_EQ (1 , unreadCountEdges.size ()) << " unreadCounts should have 1 entry" ;
585
574
ASSERT_TRUE (unreadCountEdges[0 ].is_object ()) << " unreadCount should be an object" ;
586
- auto unreadCountNode = service::ScalarArgument<> ::require (" node" , unreadCountEdges[0 ].as_object ());
575
+ auto unreadCountNode = service::ScalarArgument::require (" node" , unreadCountEdges[0 ].as_object ());
587
576
const web::json::object& folder = unreadCountNode.as_object ();
588
- EXPECT_EQ (_fakeFolderId, service::IdArgument<> ::require (" folderId" , folder)) << " id should match in base64 encoding" ;
589
- EXPECT_EQ (" \" Fake\" Inbox" , service::StringArgument<> ::require (" name" , folder)) << " name should match" ;
590
- EXPECT_EQ (3 , service::IntArgument<> ::require (" unreadCount" , folder)) << " isComplete should match" ;
577
+ EXPECT_EQ (_fakeFolderId, service::IdArgument::require (" folderId" , folder)) << " id should match in base64 encoding" ;
578
+ EXPECT_EQ (" \" Fake\" Inbox" , service::StringArgument::require (" name" , folder)) << " name should match" ;
579
+ EXPECT_EQ (3 , service::IntArgument::require (" unreadCount" , folder)) << " isComplete should match" ;
591
580
}
592
581
catch (const service::schema_exception& ex)
593
582
{
@@ -666,7 +655,6 @@ TEST_F(TodayServiceCase, MutateCompleteTaskWithPegtl)
666
655
clientMutationId
667
656
}
668
657
})gql" );
669
-
670
658
auto result = _service->resolve (*ast, " " , web::json::value::object ().as_object ());
671
659
672
660
try
@@ -680,18 +668,18 @@ TEST_F(TodayServiceCase, MutateCompleteTaskWithPegtl)
680
668
errors << errorsItr->second ;
681
669
FAIL () << utility::conversions::to_utf8string (errors.str ());
682
670
}
683
- auto data = service::ScalarArgument<> ::require (" data" , result.as_object ());
671
+ auto data = service::ScalarArgument::require (" data" , result.as_object ());
684
672
685
- auto completedTask = service::ScalarArgument<> ::require (" completedTask" , data.as_object ());
673
+ auto completedTask = service::ScalarArgument::require (" completedTask" , data.as_object ());
686
674
ASSERT_TRUE (completedTask.is_object ()) << " payload should be an object" ;
687
675
688
- auto task = service::ScalarArgument<> ::require (" completedTask" , completedTask.as_object ());
676
+ auto task = service::ScalarArgument::require (" completedTask" , completedTask.as_object ());
689
677
EXPECT_TRUE (task.is_object ()) << " should get back a task" ;
690
- EXPECT_EQ (_fakeTaskId, service::IdArgument<> ::require (" completedTaskId" , task.as_object ())) << " id should match in base64 encoding" ;
691
- EXPECT_EQ (" Mutated Task!" , service::StringArgument<> ::require (" title" , task.as_object ())) << " title should match" ;
692
- EXPECT_TRUE (service::BooleanArgument<> ::require (" isComplete" , task.as_object ())) << " isComplete should match" ;
678
+ EXPECT_EQ (_fakeTaskId, service::IdArgument::require (" completedTaskId" , task.as_object ())) << " id should match in base64 encoding" ;
679
+ EXPECT_EQ (" Mutated Task!" , service::StringArgument::require (" title" , task.as_object ())) << " title should match" ;
680
+ EXPECT_TRUE (service::BooleanArgument::require (" isComplete" , task.as_object ())) << " isComplete should match" ;
693
681
694
- auto clientMutationId = service::StringArgument<> ::require (" clientMutationId" , completedTask.as_object ());
682
+ auto clientMutationId = service::StringArgument::require (" clientMutationId" , completedTask.as_object ());
695
683
EXPECT_EQ (" Hi There!" , clientMutationId) << " clientMutationId should match" ;
696
684
}
697
685
catch (const service::schema_exception& ex)
@@ -811,7 +799,6 @@ TEST_F(TodayServiceCase, IntrospectionWithPegtl)
811
799
}
812
800
}
813
801
})gql" );
814
-
815
802
auto result = _service->resolve (*ast, " " , web::json::value::object ().as_object ());
816
803
817
804
try
@@ -825,11 +812,11 @@ TEST_F(TodayServiceCase, IntrospectionWithPegtl)
825
812
errors << errorsItr->second ;
826
813
FAIL () << utility::conversions::to_utf8string (errors.str ());
827
814
}
828
- auto data = service::ScalarArgument<> ::require (" data" , result.as_object ());
829
- auto schema = service::ScalarArgument<> ::require (" __schema" , data.as_object ());
830
- auto types = service::ModifiedArgument<web::json::value, service::TypeModifier::List>:: require (" types" , schema.as_object ());
831
- auto queryType = service::ScalarArgument<> ::require (" queryType" , schema.as_object ());
832
- auto mutationType = service::ScalarArgument<> ::require (" mutationType" , schema.as_object ());
815
+ auto data = service::ScalarArgument::require (" data" , result.as_object ());
816
+ auto schema = service::ScalarArgument::require (" __schema" , data.as_object ());
817
+ auto types = service::ScalarArgument::require< service::TypeModifier::List>(" types" , schema.as_object ());
818
+ auto queryType = service::ScalarArgument::require (" queryType" , schema.as_object ());
819
+ auto mutationType = service::ScalarArgument::require (" mutationType" , schema.as_object ());
833
820
834
821
ASSERT_FALSE (types.empty ());
835
822
ASSERT_TRUE (queryType.is_object ());
0 commit comments