@@ -622,6 +622,7 @@ describe('mutation upsertUserGeneralExperience', () => {
622622 description : 'Built a popular browser extension for developers' ,
623623 startedAt : new Date ( '2021-01-01' ) ,
624624 url : 'https://github.com/dailydotdev/extension' ,
625+ customCompanyName : 'Personal Project' ,
625626 } ,
626627 } ,
627628 } ) ;
@@ -741,13 +742,15 @@ describe('mutation upsertUserGeneralExperience', () => {
741742 title : 'Self-taught Developer' ,
742743 startedAt : new Date ( '2020-01-01' ) ,
743744 companyId : null ,
745+ customCompanyName : 'Self-taught' ,
744746 } ,
745747 } ,
746748 } ) ;
747749
748750 expect ( res . errors ) . toBeFalsy ( ) ;
749751 expect ( res . data . upsertUserGeneralExperience ) . toMatchObject ( {
750752 company : null ,
753+ customCompanyName : 'Self-taught' ,
751754 } ) ;
752755 } ) ;
753756
@@ -784,6 +787,7 @@ describe('mutation upsertUserGeneralExperience', () => {
784787 type : 'certification' ,
785788 title : 'Test' ,
786789 startedAt : new Date ( '2020-01-01' ) ,
790+ customCompanyName : 'Test Company' ,
787791 } ,
788792 } ,
789793 } ,
@@ -805,6 +809,7 @@ describe('mutation upsertUserGeneralExperience', () => {
805809 type : 'work' ,
806810 title : 'Hacked Title' ,
807811 startedAt : new Date ( '2021-01-01' ) ,
812+ customCompanyName : 'Some Company' ,
808813 } ,
809814 } ,
810815 } ,
@@ -829,6 +834,7 @@ describe('mutation upsertUserGeneralExperience', () => {
829834 type : 'project' ,
830835 title : 'Updated Project Title' ,
831836 startedAt : new Date ( '2021-06-01' ) ,
837+ companyId : 'company-1' ,
832838 } ,
833839 } ,
834840 } ) ;
@@ -959,6 +965,29 @@ describe('mutation upsertUserGeneralExperience', () => {
959965 ) ;
960966 } ) ;
961967
968+ it ( 'should fail when experience has neither companyId nor customCompanyName' , async ( ) => {
969+ loggedUser = '1' ;
970+
971+ const experienceTypes = [ 'work' , 'education' , 'project' , 'certification' ] ;
972+
973+ for ( const type of experienceTypes ) {
974+ await testQueryErrorCode (
975+ client ,
976+ {
977+ query : UPSERT_USER_GENERAL_EXPERIENCE_MUTATION ,
978+ variables : {
979+ input : {
980+ type,
981+ title : 'Test Experience' ,
982+ startedAt : new Date ( '2023-01-01' ) ,
983+ } ,
984+ } ,
985+ } ,
986+ 'ZOD_VALIDATION_ERROR' ,
987+ ) ;
988+ }
989+ } ) ;
990+
962991 it ( 'should create experience without optional fields' , async ( ) => {
963992 loggedUser = '1' ;
964993
@@ -968,6 +997,7 @@ describe('mutation upsertUserGeneralExperience', () => {
968997 type : 'project' ,
969998 title : 'Minimal Project' ,
970999 startedAt : new Date ( '2023-01-01' ) ,
1000+ customCompanyName : 'Project Organization' ,
9711001 } ,
9721002 } ,
9731003 } ) ;
@@ -981,6 +1011,7 @@ describe('mutation upsertUserGeneralExperience', () => {
9811011 endedAt : null ,
9821012 url : null ,
9831013 company : null ,
1014+ customCompanyName : 'Project Organization' ,
9841015 } ) ;
9851016 } ) ;
9861017
@@ -1244,6 +1275,7 @@ describe('mutation upsertUserWorkExperience', () => {
12441275 type : 'work' ,
12451276 title : 'Hacked Title' ,
12461277 startedAt : new Date ( '2021-01-01' ) ,
1278+ customCompanyName : 'Some Company' ,
12471279 skills : [ ] ,
12481280 } ,
12491281 } ,
@@ -1502,6 +1534,25 @@ describe('mutation upsertUserWorkExperience', () => {
15021534 skills : [ ] ,
15031535 } ) ;
15041536 } ) ;
1537+
1538+ it ( 'should fail when work experience has neither companyId nor customCompanyName' , async ( ) => {
1539+ loggedUser = '1' ;
1540+
1541+ await testQueryErrorCode (
1542+ client ,
1543+ {
1544+ query : UPSERT_USER_WORK_EXPERIENCE_MUTATION ,
1545+ variables : {
1546+ input : {
1547+ type : 'work' ,
1548+ title : 'Software Engineer' ,
1549+ startedAt : new Date ( '2023-01-01' ) ,
1550+ } ,
1551+ } ,
1552+ } ,
1553+ 'ZOD_VALIDATION_ERROR' ,
1554+ ) ;
1555+ } ) ;
15051556} ) ;
15061557
15071558describe ( 'mutation removeUserExperience' , ( ) => {
0 commit comments