@@ -730,25 +730,25 @@ describe('mutation upsertUserGeneralExperience', () => {
730730 } ) ;
731731 } ) ;
732732
733- it ( 'should set company to null when companyId is explicitly null ' , async ( ) => {
733+ it ( 'should fail when companyId is null and customCompanyName is not provided for education ' , async ( ) => {
734734 loggedUser = '1' ;
735735
736- const res = await client . mutate ( UPSERT_USER_GENERAL_EXPERIENCE_MUTATION , {
737- variables : {
738- id : 'b2c3d4e5-6789-4bcd-aef0-234567890123' ,
739- input : {
740- type : 'education' ,
741- title : 'Self-taught Developer' ,
742- startedAt : new Date ( '2020-01-01' ) ,
743- companyId : null ,
736+ await testQueryErrorCode (
737+ client ,
738+ {
739+ query : UPSERT_USER_GENERAL_EXPERIENCE_MUTATION ,
740+ variables : {
741+ id : 'b2c3d4e5-6789-4bcd-aef0-234567890123' ,
742+ input : {
743+ type : 'education' ,
744+ title : 'Self-taught Developer' ,
745+ startedAt : new Date ( '2020-01-01' ) ,
746+ companyId : null ,
747+ } ,
744748 } ,
745749 } ,
746- } ) ;
747-
748- expect ( res . errors ) . toBeFalsy ( ) ;
749- expect ( res . data . upsertUserGeneralExperience ) . toMatchObject ( {
750- company : null ,
751- } ) ;
750+ 'ZOD_VALIDATION_ERROR' ,
751+ ) ;
752752 } ) ;
753753
754754 it ( 'should fail when companyId does not exist' , async ( ) => {
@@ -804,6 +804,7 @@ describe('mutation upsertUserGeneralExperience', () => {
804804 input : {
805805 type : 'work' ,
806806 title : 'Hacked Title' ,
807+ customCompanyName : 'Custom Company' ,
807808 startedAt : new Date ( '2021-01-01' ) ,
808809 } ,
809810 } ,
0 commit comments