Fix tests.
This commit is contained in:
parent
b634ad39eb
commit
f6c0bc7b02
7 changed files with 15 additions and 8 deletions
|
@ -42,7 +42,7 @@ enum OverrideDocEnum {
|
|||
#[test]
|
||||
fn test_derived_enum() {
|
||||
// Ensure that rename works.
|
||||
assert_eq!(<SomeEnum as GraphQLType>::name(&()), Some("Some"));
|
||||
assert_eq!(<SomeEnum as GraphQLType<DefaultScalarValue>>::name(&()), Some("Some"));
|
||||
|
||||
// Ensure validity of meta info.
|
||||
let mut registry: juniper::Registry = juniper::Registry::new(FnvHashMap::default());
|
||||
|
|
|
@ -62,7 +62,7 @@ impl<'a> ToInputValue for &'a Fake {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> GraphQLType for &'a Fake {
|
||||
impl<'a> GraphQLType<DefaultScalarValue> for &'a Fake {
|
||||
type Context = ();
|
||||
type TypeInfo = ();
|
||||
|
||||
|
@ -93,7 +93,7 @@ struct WithLifetime<'a> {
|
|||
|
||||
#[test]
|
||||
fn test_derived_input_object() {
|
||||
assert_eq!(<Input as GraphQLType>::name(&()), Some("MyInput"));
|
||||
assert_eq!(<Input as GraphQLType<DefaultScalarValue>>::name(&()), Some("MyInput"));
|
||||
|
||||
// Validate meta info.
|
||||
let mut registry: juniper::Registry = juniper::Registry::new(FnvHashMap::default());
|
||||
|
|
|
@ -170,7 +170,7 @@ fn test_doc_comment_override() {
|
|||
|
||||
#[test]
|
||||
fn test_derived_object() {
|
||||
assert_eq!(<Obj as GraphQLType>::name(&()), Some("MyObj"));
|
||||
assert_eq!(<Obj as GraphQLType<DefaultScalarValue>>::name(&()), Some("MyObj"));
|
||||
|
||||
// Verify meta info.
|
||||
let mut registry: juniper::Registry = juniper::Registry::new(FnvHashMap::default());
|
||||
|
|
|
@ -31,7 +31,7 @@ impl User2 {
|
|||
|
||||
#[test]
|
||||
fn test_scalar_value_simple() {
|
||||
assert_eq!(<UserId as GraphQLType>::name(&()), Some("UserId"));
|
||||
assert_eq!(<UserId as GraphQLType<DefaultScalarValue>>::name(&()), Some("UserId"));
|
||||
|
||||
let mut registry: juniper::Registry = juniper::Registry::new(FnvHashMap::default());
|
||||
let meta = UserId::meta(&(), &mut registry);
|
||||
|
@ -49,7 +49,7 @@ fn test_scalar_value_simple() {
|
|||
|
||||
#[test]
|
||||
fn test_scalar_value_custom() {
|
||||
assert_eq!(<CustomUserId as GraphQLType>::name(&()), Some("MyUserId"));
|
||||
assert_eq!(<CustomUserId as GraphQLType<DefaultScalarValue>>::name(&()), Some("MyUserId"));
|
||||
|
||||
let mut registry: juniper::Registry = juniper::Registry::new(FnvHashMap::default());
|
||||
let meta = CustomUserId::meta(&(), &mut registry);
|
||||
|
|
|
@ -37,6 +37,13 @@ impl ScalarValue for MyScalarValue {
|
|||
}
|
||||
}
|
||||
|
||||
fn as_str(&self) -> Option<&str> {
|
||||
match *self {
|
||||
MyScalarValue::String(ref s) => Some(s.as_str()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
fn as_float(&self) -> Option<f64> {
|
||||
match *self {
|
||||
MyScalarValue::Int(ref i) => Some(*i as f64),
|
||||
|
|
|
@ -5,7 +5,7 @@ use crate::{
|
|||
executor::{ExecutionResult, Executor, Registry},
|
||||
schema::meta::MetaType,
|
||||
types::base::{Arguments, GraphQLType},
|
||||
value::{ScalarValue, Value},
|
||||
value::{ScalarValue},
|
||||
};
|
||||
|
||||
impl<S, T, CtxT> GraphQLType<S> for Box<T>
|
||||
|
|
|
@ -139,7 +139,7 @@ fn impl_scalar_struct(
|
|||
info: &(),
|
||||
selection: Option<&[#crate_name::Selection<S>]>,
|
||||
executor: &#crate_name::Executor<Self::Context, S>,
|
||||
) -> #crate_name::Value<S> {
|
||||
) -> #crate_name::ExecutionResult<S> {
|
||||
#crate_name::GraphQLType::resolve(&self.0, info, selection, executor)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue