@@ -199,31 +199,6 @@ describe("IPFS", async () => {
199199 expect ( json . description ) . to . equal ( "Uploading alone without a directory..." ) ;
200200 } ) ;
201201
202- it ( "Should upload without directory if specified on class" , async ( ) => {
203- const solanaStorage = new ThirdwebStorage ( {
204- uploader : new IpfsUploader ( { uploadWithGatewayUrl : true } ) ,
205- } ) ;
206-
207- const uri = await solanaStorage . upload (
208- {
209- name : "Upload Without Directory" ,
210- description : "Uploading alone without a directory..." ,
211- } ,
212- {
213- uploadWithoutDirectory : true ,
214- } ,
215- ) ;
216-
217- expect ( uri ) . to . equal (
218- "ipfs://QmdnBEP9UFcRfbuAyXFefNccNbuKWTscHrpWZatvqz9VcV" ,
219- ) ;
220-
221- const json = await storage . downloadJSON ( uri ) ;
222-
223- expect ( json . name ) . to . equal ( "Upload Without Directory" ) ;
224- expect ( json . description ) . to . equal ( "Uploading alone without a directory..." ) ;
225- } ) ;
226-
227202 it ( "Should throw an error on upload without directory with multiple uploads" , async ( ) => {
228203 try {
229204 await storage . uploadBatch (
@@ -267,7 +242,28 @@ describe("IPFS", async () => {
267242 ) ;
268243 } ) ;
269244
270- it ( "Should upload files with gateway URLs if specified" , async ( ) => {
245+ it ( "Should upload files with gateway URLs if specified on class" , async ( ) => {
246+ const uploader = new IpfsUploader ( { uploadWithGatewayUrl : true } ) ;
247+ const singleStorage = new ThirdwebStorage ( { uploader } ) ;
248+
249+ const uri = await singleStorage . upload ( {
250+ // Gateway URLs should first be converted back to ipfs:// and then all ipfs:// should convert to first gateway URL
251+ image : readFileSync ( "test/files/0.jpg" ) ,
252+ animation_url : "ipfs://QmbaNzUcv7KPgdwq9u2qegcptktpUK6CdRZF72eSjSa6iJ/0" ,
253+ } ) ;
254+
255+ const res = await singleStorage . download ( uri ) ;
256+ const json = await res . json ( ) ;
257+
258+ expect ( json . image ) . to . equal (
259+ `${ DEFAULT_GATEWAY_URLS [ "ipfs://" ] [ 0 ] } QmcCJC4T37rykDjR6oorM8hpB9GQWHKWbAi2YR1uTabUZu/0` ,
260+ ) ;
261+ expect ( json . animation_url ) . to . equal (
262+ `${ DEFAULT_GATEWAY_URLS [ "ipfs://" ] [ 0 ] } QmbaNzUcv7KPgdwq9u2qegcptktpUK6CdRZF72eSjSa6iJ/0` ,
263+ ) ;
264+ } ) ;
265+
266+ it ( "Should upload files with gateway URLs if specified on function" , async ( ) => {
271267 const uri = await storage . upload (
272268 {
273269 // Gateway URLs should first be converted back to ipfs:// and then all ipfs:// should convert to first gateway URL
0 commit comments