-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add runtime test validating plural @LiVe field
Reviewed By: voideanvalue Differential Revision: D45677696 fbshipit-source-id: 12b16097e1be9fb62dd1167dd4ef8aae0cdbfd8c
- Loading branch information
1 parent
6347254
commit 6a80a0f
Showing
5 changed files
with
400 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
251 changes: 251 additions & 0 deletions
251
...lay/__tests__/__generated__/RelayResolversWithOutputTypeTestManyLiveTodosQuery.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/relay-runtime/store/__tests__/resolvers/QueryManyLiveTodos.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow strict-local | ||
* @format | ||
* @oncall relay | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {LiveState} from '../../experimental-live-resolvers/LiveResolverStore'; | ||
|
||
const { | ||
Selectors, | ||
TODO_STORE, | ||
} = require('relay-runtime/store/__tests__/resolvers/ExampleTodoStore'); | ||
|
||
/** | ||
* @RelayResolver Query.many_live_todos: [Todo] | ||
* @live | ||
*/ | ||
function many_live_todos(): LiveState<$ReadOnlyArray<{todo_id: string}>> { | ||
return { | ||
read() { | ||
return Selectors.getTodoIDs(TODO_STORE.getState()).map(id => ({ | ||
todo_id: id, | ||
})); | ||
}, | ||
subscribe(cb) { | ||
return TODO_STORE.subscribe(null, cb); | ||
}, | ||
}; | ||
} | ||
|
||
module.exports = { | ||
many_live_todos, | ||
}; |
Oops, something went wrong.