Skip to content

Commit

Permalink
Added case which checks for custom context
Browse files Browse the repository at this point in the history
  • Loading branch information
jmpunkt committed Apr 16, 2020
1 parent e67bd57 commit 5cdb53d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions integration_tests/juniper_tests/src/codegen/derive_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ use fnv::FnvHashMap;
#[cfg(test)]
use juniper::{self, DefaultScalarValue, FromInputValue, GraphQLType, InputValue, ToInputValue};

pub struct CustomContext {}

impl juniper::Context for CustomContext {}

#[derive(juniper::GraphQLEnum, Debug, PartialEq)]
#[graphql(name = "Some", description = "enum descr")]
enum SomeEnum {
Expand Down Expand Up @@ -98,3 +102,16 @@ fn test_doc_comment_override() {
let meta = OverrideDocEnum::meta(&(), &mut registry);
assert_eq!(meta.description(), Some(&"enum override".to_string()));
}

fn test_context<T>(_t: T)
where
T: GraphQLType<DefaultScalarValue, Context = CustomContext>,
{
// empty
}

#[test]
fn test_doc_custom_context() {
test_context(ContextEnum::A);
// test_context(OverrideDocEnum::Foo); does not work
}

0 comments on commit 5cdb53d

Please sign in to comment.