File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -76,5 +76,9 @@ export async function validateSpaceSettings(
76
76
if ( strategy . disabled ) {
77
77
return Promise . reject ( `strategy "${ id } " is not available anymore` ) ;
78
78
}
79
+
80
+ if ( strategy . override && spaceType !== 'turbo' ) {
81
+ return Promise . reject ( `strategy "${ id } " is only available for pro spaces` ) ;
82
+ }
79
83
}
80
84
}
Original file line number Diff line number Diff line change @@ -109,6 +109,37 @@ describe('helpers/validation', () => {
109
109
'strategy "strategy1" is not available anymore'
110
110
) ;
111
111
} ) ;
112
+
113
+ it ( 'should reject override strategy for non-turbo space' , async ( ) => {
114
+ mockStrategies [ 'override-strategy' ] = {
115
+ id : 'override-strategy' ,
116
+ disabled : false ,
117
+ override : true
118
+ } ;
119
+
120
+ const space = createMockSpace ( {
121
+ strategies : [ { name : 'override-strategy' , params : { } } ]
122
+ } ) ;
123
+
124
+ await expect ( validateSpaceSettings ( space , 'mainnet' ) ) . rejects . toBe (
125
+ 'strategy "override-strategy" is only available for pro spaces'
126
+ ) ;
127
+ } ) ;
128
+
129
+ it ( 'should allow override strategy for turbo space' , async ( ) => {
130
+ mockStrategies [ 'override-strategy' ] = {
131
+ id : 'override-strategy' ,
132
+ disabled : false ,
133
+ override : true
134
+ } ;
135
+
136
+ const space = createMockSpace ( {
137
+ turbo : true ,
138
+ strategies : [ { name : 'override-strategy' , params : { } } ]
139
+ } ) ;
140
+
141
+ await expect ( validateSpaceSettings ( space , 'mainnet' ) ) . resolves . toBeUndefined ( ) ;
142
+ } ) ;
112
143
} ) ;
113
144
114
145
describe ( 'other validations' , ( ) => {
You can’t perform that action at this time.
0 commit comments