@@ -96,7 +96,15 @@ describe('user send password reset email', () => {
9696 `
9797 mutation {
9898 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
99- status
99+ result {
100+ ... on SendPhoneCodeResult {
101+ status
102+ }
103+ ... on SendPhoneCodeError {
104+ code
105+ description
106+ }
107+ }
100108 }
101109 }
102110 ` ,
@@ -125,8 +133,10 @@ describe('user send password reset email', () => {
125133 const expectedResult = {
126134 data : {
127135 sendPhoneCode : {
128- status :
129- 'Two factor code has been successfully sent, you will receive a text message shortly.' ,
136+ result : {
137+ status :
138+ 'Two factor code has been successfully sent, you will receive a text message shortly.' ,
139+ } ,
130140 } ,
131141 } ,
132142 }
@@ -163,7 +173,15 @@ describe('user send password reset email', () => {
163173 `
164174 mutation {
165175 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
166- status
176+ result {
177+ ... on SendPhoneCodeResult {
178+ status
179+ }
180+ ... on SendPhoneCodeError {
181+ code
182+ description
183+ }
184+ }
167185 }
168186 }
169187 ` ,
@@ -189,11 +207,18 @@ describe('user send password reset email', () => {
189207 } ,
190208 )
191209
192- const error = [
193- new GraphQLError ( 'Unable to send TFA code, please try again.' ) ,
194- ]
210+ const error = {
211+ data : {
212+ sendPhoneCode : {
213+ result : {
214+ code : 400 ,
215+ description : 'Unable to send TFA code, please try again.' ,
216+ } ,
217+ } ,
218+ } ,
219+ }
195220
196- expect ( response . errors ) . toEqual ( error )
221+ expect ( response ) . toEqual ( error )
197222 expect ( consoleOutput ) . toEqual ( [
198223 `User attempted to send TFA text message, however no account is associated with this key: 1.` ,
199224 ] )
@@ -206,7 +231,15 @@ describe('user send password reset email', () => {
206231 `
207232 mutation {
208233 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
209- status
234+ result {
235+ ... on SendPhoneCodeResult {
236+ status
237+ }
238+ ... on SendPhoneCodeError {
239+ code
240+ description
241+ }
242+ }
210243 }
211244 }
212245 ` ,
@@ -232,11 +265,18 @@ describe('user send password reset email', () => {
232265 } ,
233266 )
234267
235- const error = [
236- new GraphQLError ( 'Authentication error, please sign in again.' ) ,
237- ]
268+ const error = {
269+ data : {
270+ sendPhoneCode : {
271+ result : {
272+ code : 400 ,
273+ description : 'Authentication error, please sign in again.' ,
274+ } ,
275+ } ,
276+ } ,
277+ }
238278
239- expect ( response . errors ) . toEqual ( error )
279+ expect ( response ) . toEqual ( error )
240280 expect ( consoleOutput ) . toEqual ( [
241281 `User attempted to send TFA text message, however the userKey does not exist.` ,
242282 ] )
@@ -255,7 +295,15 @@ describe('user send password reset email', () => {
255295 `
256296 mutation {
257297 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
258- status
298+ result {
299+ ... on SendPhoneCodeResult {
300+ status
301+ }
302+ ... on SendPhoneCodeError {
303+ code
304+ description
305+ }
306+ }
259307 }
260308 }
261309 ` ,
@@ -305,7 +353,15 @@ describe('user send password reset email', () => {
305353 `
306354 mutation {
307355 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
308- status
356+ result {
357+ ... on SendPhoneCodeResult {
358+ status
359+ }
360+ ... on SendPhoneCodeError {
361+ code
362+ description
363+ }
364+ }
309365 }
310366 }
311367 ` ,
@@ -375,7 +431,15 @@ describe('user send password reset email', () => {
375431 `
376432 mutation {
377433 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
378- status
434+ result {
435+ ... on SendPhoneCodeResult {
436+ status
437+ }
438+ ... on SendPhoneCodeError {
439+ code
440+ description
441+ }
442+ }
379443 }
380444 }
381445 ` ,
@@ -404,7 +468,9 @@ describe('user send password reset email', () => {
404468 const expectedResult = {
405469 data : {
406470 sendPhoneCode : {
407- status : 'todo' ,
471+ result : {
472+ status : 'todo' ,
473+ } ,
408474 } ,
409475 } ,
410476 }
@@ -441,7 +507,15 @@ describe('user send password reset email', () => {
441507 `
442508 mutation {
443509 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
444- status
510+ result {
511+ ... on SendPhoneCodeResult {
512+ status
513+ }
514+ ... on SendPhoneCodeError {
515+ code
516+ description
517+ }
518+ }
445519 }
446520 }
447521 ` ,
@@ -467,9 +541,18 @@ describe('user send password reset email', () => {
467541 } ,
468542 )
469543
470- const error = [ new GraphQLError ( 'todo' ) ]
544+ const error = {
545+ data : {
546+ sendPhoneCode : {
547+ result : {
548+ code : 400 ,
549+ description : 'todo' ,
550+ } ,
551+ } ,
552+ } ,
553+ }
471554
472- expect ( response . errors ) . toEqual ( error )
555+ expect ( response ) . toEqual ( error )
473556 expect ( consoleOutput ) . toEqual ( [
474557 `User attempted to send TFA text message, however no account is associated with this key: 1.` ,
475558 ] )
@@ -482,7 +565,15 @@ describe('user send password reset email', () => {
482565 `
483566 mutation {
484567 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
485- status
568+ result {
569+ ... on SendPhoneCodeResult {
570+ status
571+ }
572+ ... on SendPhoneCodeError {
573+ code
574+ description
575+ }
576+ }
486577 }
487578 }
488579 ` ,
@@ -508,9 +599,18 @@ describe('user send password reset email', () => {
508599 } ,
509600 )
510601
511- const error = [ new GraphQLError ( 'todo' ) ]
602+ const error = {
603+ data : {
604+ sendPhoneCode : {
605+ result : {
606+ code : 400 ,
607+ description : 'todo' ,
608+ } ,
609+ } ,
610+ } ,
611+ }
512612
513- expect ( response . errors ) . toEqual ( error )
613+ expect ( response ) . toEqual ( error )
514614 expect ( consoleOutput ) . toEqual ( [
515615 `User attempted to send TFA text message, however the userKey does not exist.` ,
516616 ] )
@@ -529,7 +629,15 @@ describe('user send password reset email', () => {
529629 `
530630 mutation {
531631 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
532- status
632+ result {
633+ ... on SendPhoneCodeResult {
634+ status
635+ }
636+ ... on SendPhoneCodeError {
637+ code
638+ description
639+ }
640+ }
533641 }
534642 }
535643 ` ,
@@ -576,7 +684,15 @@ describe('user send password reset email', () => {
576684 `
577685 mutation {
578686 sendPhoneCode(input: { phoneNumber: "+12345678901" }) {
579- status
687+ result {
688+ ... on SendPhoneCodeResult {
689+ status
690+ }
691+ ... on SendPhoneCodeError {
692+ code
693+ description
694+ }
695+ }
580696 }
581697 }
582698 ` ,
0 commit comments