@@ -2,8 +2,6 @@ import test from "ava";
22import sinon from "sinon" ;
33
44import { ActionsEnvVars } from "../environment" ;
5- import * as errors from "../error-messages" ;
6- import { Feature } from "../feature-flags" ;
75import { callee } from "../testing-utils" ;
86import { ConfigurationError } from "../util" ;
97
@@ -75,15 +73,7 @@ test("parseRemoteFileAddress accepts full remote addresses", async (t) => {
7573 for ( const newFormatInput of newFormatInputs ) {
7674 const targetWithArgs = target . withArgs ( newFormatInput . input ) ;
7775
78- // Should fail when the FF is not enabled.
79- await targetWithArgs
80- . withFeatures ( [ ] )
81- . throws ( t , { instanceOf : ConfigurationError } ) ;
82-
83- // And pass when the FF is enabled.
84- await targetWithArgs
85- . withFeatures ( [ Feature . NewRemoteFileAddresses ] )
86- . passes ( t . deepEqual , newFormatInput . expected ) ;
76+ await targetWithArgs . passes ( t . deepEqual , newFormatInput . expected ) ;
8777 }
8878} ) ;
8979
@@ -138,15 +128,7 @@ test("parseRemoteFileAddress accepts remote address without an owner", async (t)
138128 for ( const testCase of testCases ) {
139129 const targetWithArgs = target . withArgs ( testCase . input ) ;
140130
141- // Should fail when the FF is not enabled.
142- await targetWithArgs
143- . withFeatures ( [ ] )
144- . throws ( t , { instanceOf : ConfigurationError } ) ;
145-
146- // And pass when the FF is enabled.
147- await targetWithArgs
148- . withFeatures ( [ Feature . NewRemoteFileAddresses ] )
149- . passes ( t . deepEqual , testCase . expected ) ;
131+ await targetWithArgs . passes ( t . deepEqual , testCase . expected ) ;
150132 }
151133} ) ;
152134
@@ -160,9 +142,7 @@ test("parseRemoteFileAddress throws for invalid `GITHUB_REPOSITORY`", async (t)
160142 sinon . define ( env , "getRequired" , getRequired ) ;
161143 } ) ;
162144
163- await target
164- . withFeatures ( [ Feature . NewRemoteFileAddresses ] )
165- . throws ( t , { instanceOf : Error } ) ;
145+ await target . throws ( t , { instanceOf : Error } ) ;
166146
167147 t . assert ( getRequired . calledOnceWith ( ActionsEnvVars . GITHUB_REPOSITORY ) ) ;
168148} ) ;
@@ -194,31 +174,19 @@ test("parseRemoteFileAddress accepts remote address without a path", async (t) =
194174 for ( const testCase of testCases ) {
195175 const targetWithArgs = target . withArgs ( testCase . input ) ;
196176
197- // Should fail when the FF is not enabled.
198- await targetWithArgs
199- . withFeatures ( [ ] )
200- . throws ( t , { instanceOf : ConfigurationError } ) ;
201-
202- // And pass when the FF is enabled.
203- await targetWithArgs
204- . withFeatures ( [ Feature . NewRemoteFileAddresses ] )
205- . passes ( t . deepEqual , testCase . expected ) ;
177+ await targetWithArgs . passes ( t . deepEqual , testCase . expected ) ;
206178 }
207179} ) ;
208180
209181test ( "parseRemoteFileAddress accepts remote address without a ref" , async ( t ) => {
210182 const target = callee ( parseRemoteFileAddress ) . withArgs ( "owner/repo:path" ) ;
211183
212- // Should only accept the input if the FF is enabled.
213- await target . withFeatures ( [ ] ) . throws ( t ) ;
214- await target
215- . withFeatures ( [ Feature . NewRemoteFileAddresses ] )
216- . passes ( t . deepEqual , {
217- owner : "owner" ,
218- repo : "repo" ,
219- path : "path" ,
220- ref : DEFAULT_CONFIG_FILE_REF ,
221- } satisfies RemoteFileAddress ) ;
184+ await target . passes ( t . deepEqual , {
185+ owner : "owner" ,
186+ repo : "repo" ,
187+ path : "path" ,
188+ ref : DEFAULT_CONFIG_FILE_REF ,
189+ } satisfies RemoteFileAddress ) ;
222190} ) ;
223191
224192test ( "parseRemoteFileAddress rejects invalid values" , async ( t ) => {
@@ -251,18 +219,11 @@ test("parseRemoteFileAddress rejects invalid values", async (t) => {
251219 for ( const testInput of testInputs ) {
252220 const targetWithArgs = target . withArgs ( testInput ) ;
253221
254- // Should throw both when the new format is and isn't accepted.
255- await targetWithArgs . withFeatures ( [ ] ) . throws ( t , {
222+ await targetWithArgs . throws ( t , {
223+ // When the new format is accepted, there are some more specific
224+ // errors in some cases. It is sufficient for us to check that
225+ // an exception is thrown.
256226 instanceOf : ConfigurationError ,
257- message : errors . getConfigFileRepoOldFormatInvalidMessage ( testInput ) ,
258227 } ) ;
259- await targetWithArgs
260- . withFeatures ( [ Feature . NewRemoteFileAddresses ] )
261- . throws ( t , {
262- // When the new format is accepted, there are some more specific
263- // errors in some cases. It is sufficient for us to check that
264- // an exception is thrown.
265- instanceOf : ConfigurationError ,
266- } ) ;
267228 }
268229} ) ;
0 commit comments