You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: guides/dataloader/testing.md
+22-7Lines changed: 22 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,22 @@ You could also make specific assertions on the queries that are run (see the [`s
43
43
44
44
## Testing Dataloader Sources
45
45
46
-
You can also test `Dataloader` behavior outside of GraphQL using {{ "GraphQL::Dataloader.with_dataloading" | api_doc }}. For example:
46
+
You can also test `Dataloader` behavior outside of GraphQL using {{ "GraphQL::Dataloader.with_dataloading" | api_doc }}. For example, let's if you have a `Sources::ActiveRecord` source defined like so:
47
+
48
+
```ruby
49
+
50
+
moduleSources
51
+
classUser < GraphQL::Dataloader::Source
52
+
deffetch(ids)
53
+
records =User.where(id: ids)
54
+
# return a list with `nil` for any ID that wasn't found, so the shape matches
0 commit comments