-
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 fixture test to assert we don't allow duplicate resolver definitions
Summary: * Add a fixture asserting we don't allow duplicate resolver definitions Reviewed By: captbaritone Differential Revision: D44265525 fbshipit-source-id: 7022f4925fe03db6428005a7d68048e5afe069e2
- Loading branch information
1 parent
35fea88
commit 0466d31
Showing
3 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
...crates/relay-docblock/tests/to_schema/fixtures/terse-resolver-duplicated.invalid.expected
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,55 @@ | ||
==================================== INPUT ==================================== | ||
/** | ||
* 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. | ||
*/ | ||
|
||
// expected-to-throw | ||
|
||
/** | ||
* @RelayResolver User.favorite_page: Page | ||
* @rootFragment myRootFragment | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` | ||
|
||
/** | ||
* @RelayResolver User.favorite_page: Page | ||
* @rootFragment myRootFragment2 | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment2 on User { | ||
name | ||
} | ||
` | ||
==================================== ERROR ==================================== | ||
✖︎ Duplicate field definition 'favorite_page' found. | ||
|
||
/path/to/test/fixture/terse-resolver-duplicated.invalid.js:2:23 | ||
1 │ * | ||
2 │ * @RelayResolver User.favorite_page: Page | ||
│ ^^^^^^^^^^^^^ | ||
3 │ * @rootFragment myRootFragment2 | ||
|
||
ℹ︎ previously defined here | ||
|
||
/path/to/test/fixture/terse-resolver-duplicated.invalid.js:2:24 | ||
1 │ * | ||
2 │ * @RelayResolver User.favorite_page: Page | ||
│ ^^^^^^^^^^^^^ | ||
3 │ * @rootFragment myRootFragment2 |
38 changes: 38 additions & 0 deletions
38
compiler/crates/relay-docblock/tests/to_schema/fixtures/terse-resolver-duplicated.invalid.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,38 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
// expected-to-throw | ||
|
||
/** | ||
* @RelayResolver User.favorite_page: Page | ||
* @rootFragment myRootFragment | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment on User { | ||
name | ||
} | ||
` | ||
|
||
/** | ||
* @RelayResolver User.favorite_page: Page | ||
* @rootFragment myRootFragment2 | ||
* | ||
* The user's favorite page! They probably clicked something in the UI | ||
* to tell us that it was their favorite page and then we put that in a | ||
* database or something. Then we got that info out again and put it out | ||
* again. Anyway, I'm rambling now. Its a page that the user likes. A lot. | ||
*/ | ||
graphql` | ||
fragment myRootFragment2 on User { | ||
name | ||
} | ||
` |
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