File: type-interface.t

package info (click to toggle)
libgraphql-perl 0.54-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 712 kB
  • sloc: perl: 5,094; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 599 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use 5.014;
use strict;
use warnings;
use Test::More;
use Test::Exception;

BEGIN {
  use_ok( 'GraphQL::Type::Interface' ) || print "Bail out!\n";
  use_ok( 'GraphQL::Type::Scalar', qw($String) ) || print "Bail out!\n";
}

my $interface_type = GraphQL::Type::Interface->new(
  name => 'Interface',
  fields => { field_name => { type => $String } },
  resolve_type => sub {
    return $String;
  },
);

throws_ok {
  GraphQL::Type::Interface->new(
    name => '@Interface',
    fields => { field_name => { type => $String } },
  )
} qr/did not pass type constraint/, 'name validation';

done_testing;