@@ -15,107 +15,105 @@ import { graphql } from 'graphql';
1515// 80+ char lines are useful in describe/it, so ignore in this file.
1616/*eslint-disable max-len */
1717
18- describe ( 'Object Identification Tests' , ( ) => {
19- describe ( 'Fetching Tests' , ( ) => {
20- it ( 'Correctly fetches the ID and name of the rebels' , async ( ) => {
21- var query = `
22- query RebelsQuery {
23- rebels {
24- id
25- name
26- }
27- }
28- ` ;
29- var expected = {
30- rebels : {
31- id : 'RmFjdGlvbjox' ,
32- name : 'Alliance to Restore the Republic'
33- }
34- } ;
35- var result = await graphql ( StarWarsSchema , query ) ;
36- expect ( result ) . to . deep . equal ( { data : expected } ) ;
37- } ) ;
38-
39- it ( 'Correctly refetches the rebels' , async ( ) => {
40- var query = `
41- query RebelsRefetchQuery {
42- node(id: "RmFjdGlvbjox") {
43- id
44- ... on Faction {
45- name
46- }
47- }
18+ describe ( 'Star Wars object identification' , ( ) => {
19+ it ( 'fetches the ID and name of the rebels' , async ( ) => {
20+ var query = `
21+ query RebelsQuery {
22+ rebels {
23+ id
24+ name
4825 }
49- ` ;
50- var expected = {
51- node : {
52- id : 'RmFjdGlvbjox' ,
53- name : 'Alliance to Restore the Republic'
54- }
55- } ;
56- var result = await graphql ( StarWarsSchema , query ) ;
57- expect ( result ) . to . deep . equal ( { data : expected } ) ;
58- } ) ;
26+ }
27+ ` ;
28+ var expected = {
29+ rebels : {
30+ id : 'RmFjdGlvbjox' ,
31+ name : 'Alliance to Restore the Republic'
32+ }
33+ } ;
34+ var result = await graphql ( StarWarsSchema , query ) ;
35+ expect ( result ) . to . deep . equal ( { data : expected } ) ;
36+ } ) ;
5937
60- it ( 'Correctly fetches the ID and name of the empire' , async ( ) => {
61- var query = `
62- query EmpireQuery {
63- empire {
64- id
38+ it ( 'refetches the rebels' , async ( ) => {
39+ var query = `
40+ query RebelsRefetchQuery {
41+ node(id: "RmFjdGlvbjox") {
42+ id
43+ ... on Faction {
6544 name
6645 }
6746 }
68- ` ;
69- var expected = {
70- empire : {
71- id : 'RmFjdGlvbjoy' ,
72- name : 'Galactic Empire'
47+ }
48+ ` ;
49+ var expected = {
50+ node : {
51+ id : 'RmFjdGlvbjox' ,
52+ name : 'Alliance to Restore the Republic'
53+ }
54+ } ;
55+ var result = await graphql ( StarWarsSchema , query ) ;
56+ expect ( result ) . to . deep . equal ( { data : expected } ) ;
57+ } ) ;
58+
59+ it ( 'fetches the ID and name of the empire' , async ( ) => {
60+ var query = `
61+ query EmpireQuery {
62+ empire {
63+ id
64+ name
7365 }
74- } ;
75- var result = await graphql ( StarWarsSchema , query ) ;
76- expect ( result ) . to . deep . equal ( { data : expected } ) ;
77- } ) ;
66+ }
67+ ` ;
68+ var expected = {
69+ empire : {
70+ id : 'RmFjdGlvbjoy' ,
71+ name : 'Galactic Empire'
72+ }
73+ } ;
74+ var result = await graphql ( StarWarsSchema , query ) ;
75+ expect ( result ) . to . deep . equal ( { data : expected } ) ;
76+ } ) ;
7877
79- it ( 'Correctly refetches the empire' , async ( ) => {
80- var query = `
81- query EmpireRefetchQuery {
82- node(id: "RmFjdGlvbjoy") {
83- id
84- ... on Faction {
85- name
86- }
78+ it ( 'refetches the empire' , async ( ) => {
79+ var query = `
80+ query EmpireRefetchQuery {
81+ node(id: "RmFjdGlvbjoy") {
82+ id
83+ ... on Faction {
84+ name
8785 }
8886 }
89- ` ;
90- var expected = {
91- node : {
92- id : 'RmFjdGlvbjoy' ,
93- name : 'Galactic Empire'
94- }
95- } ;
96- var result = await graphql ( StarWarsSchema , query ) ;
97- expect ( result ) . to . deep . equal ( { data : expected } ) ;
98- } ) ;
87+ }
88+ ` ;
89+ var expected = {
90+ node : {
91+ id : 'RmFjdGlvbjoy' ,
92+ name : 'Galactic Empire'
93+ }
94+ } ;
95+ var result = await graphql ( StarWarsSchema , query ) ;
96+ expect ( result ) . to . deep . equal ( { data : expected } ) ;
97+ } ) ;
9998
100- it ( 'Correctly refetches the X-Wing' , async ( ) => {
101- var query = `
102- query XWingRefetchQuery {
103- node(id: "U2hpcDox") {
104- id
105- ... on Ship {
106- name
107- }
99+ it ( 'refetches the X-Wing' , async ( ) => {
100+ var query = `
101+ query XWingRefetchQuery {
102+ node(id: "U2hpcDox") {
103+ id
104+ ... on Ship {
105+ name
108106 }
109107 }
110- ` ;
111- var expected = {
112- node : {
113- id : 'U2hpcDox' ,
114- name : 'X-Wing'
115- }
116- } ;
117- var result = await graphql ( StarWarsSchema , query ) ;
118- expect ( result ) . to . deep . equal ( { data : expected } ) ;
119- } ) ;
108+ }
109+ ` ;
110+ var expected = {
111+ node : {
112+ id : 'U2hpcDox' ,
113+ name : 'X-Wing'
114+ }
115+ } ;
116+ var result = await graphql ( StarWarsSchema , query ) ;
117+ expect ( result ) . to . deep . equal ( { data : expected } ) ;
120118 } ) ;
121119} ) ;
0 commit comments