@@ -2581,3 +2581,66 @@ describe('listFormComponentsProactiveHelp', () => {
25812581 expect ( result ) . toEqual ( { } ) ;
25822582 } ) ;
25832583} ) ;
2584+
2585+ describe ( '_setAllowSubmitterToUploadFile' , ( ) => {
2586+ it ( 'returns true if identityProviders does not include public' , ( ) => {
2587+ const formData = {
2588+ identityProviders : [ { code : 'idir' } ] ,
2589+ allowSubmitterToUploadFile : true ,
2590+ } ;
2591+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( true ) ;
2592+ } ) ;
2593+
2594+ it ( 'returns false if identityProviders includes public and allowSubmitterToUploadFile is truthy' , ( ) => {
2595+ const formData = {
2596+ identityProviders : [ { code : 'public' } ] ,
2597+ allowSubmitterToUploadFile : true ,
2598+ } ;
2599+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( false ) ;
2600+ } ) ;
2601+
2602+ it ( 'returns false if allowSubmitterToUploadFile is false' , ( ) => {
2603+ const formData = {
2604+ identityProviders : [ { code : 'idir' } ] ,
2605+ allowSubmitterToUploadFile : false ,
2606+ } ;
2607+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( false ) ;
2608+ } ) ;
2609+
2610+ it ( 'returns true if identityProviders is missing (team protected) and allow is true' , ( ) => {
2611+ const formData = {
2612+ allowSubmitterToUploadFile : true ,
2613+ } ;
2614+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( true ) ;
2615+ } ) ;
2616+
2617+ it ( 'returns false if identityProviders is missing (team protected) and allow is false' , ( ) => {
2618+ const formData = {
2619+ allowSubmitterToUploadFile : false ,
2620+ } ;
2621+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( false ) ;
2622+ } ) ;
2623+
2624+ it ( 'returns true if identityProviders is empty and allow is true' , ( ) => {
2625+ const formData = {
2626+ identityProviders : [ ] ,
2627+ allowSubmitterToUploadFile : true ,
2628+ } ;
2629+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( true ) ;
2630+ } ) ;
2631+
2632+ it ( 'returns false if identityProviders is empty and allow is false' , ( ) => {
2633+ const formData = {
2634+ identityProviders : [ ] ,
2635+ allowSubmitterToUploadFile : false ,
2636+ } ;
2637+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( false ) ;
2638+ } ) ;
2639+
2640+ it ( 'returns false if allowSubmitterToUploadFile is missing' , ( ) => {
2641+ const formData = {
2642+ identityProviders : [ { code : 'idir' } ] ,
2643+ } ;
2644+ expect ( service . _setAllowSubmitterToUploadFile ( formData ) ) . toBe ( false ) ;
2645+ } ) ;
2646+ } ) ;
0 commit comments