@@ -52,7 +52,7 @@ test('fetchCAR', async () => {
52
52
const requests = [ ]
53
53
const mockedFetch = async url => {
54
54
requests . push ( url . toString ( ) )
55
- return fetch ( `https://frisbii.fly.dev/ipfs/ ${ KNOWN_CID } ` )
55
+ return fetch ( url )
56
56
}
57
57
const spark = new Spark ( { fetch : mockedFetch } )
58
58
const stats = {
@@ -65,21 +65,20 @@ test('fetchCAR', async () => {
65
65
carChecksum : null ,
66
66
statusCode : null
67
67
}
68
- await spark . fetchCAR ( 'http' , '/ip4/127.0.0.1/tcp/80/http' , KNOWN_CID , stats )
68
+ await spark . fetchCAR ( 'http' , '/dns/frisbii.fly.dev/tcp/443/https' , KNOWN_CID , stats )
69
+ assertEquals ( stats . statusCode , 200 , 'stats.statusCode' )
69
70
assertEquals ( stats . timeout , false , 'stats.timeout' )
70
71
assertInstanceOf ( stats . startAt , Date )
71
72
assertInstanceOf ( stats . firstByteAt , Date )
72
73
assertInstanceOf ( stats . endAt , Date )
73
74
assertEquals ( stats . carTooLarge , false , 'stats.carTooLarge' )
74
75
assertEquals ( stats . byteLength , 200 , 'stats.byteLength' )
75
76
assertEquals ( stats . carChecksum , '122069f03061f7ad4c14a5691b7e96d3ddd109023a6539a0b4230ea3dc92050e7136' , 'stats.carChecksum' )
76
- assertEquals ( stats . statusCode , 200 , 'stats.statusCode' )
77
- assertEquals ( requests , [ `http://127.0.0.1/ipfs/${ KNOWN_CID } ?dag-scope=block` ] )
77
+ assertEquals ( requests , [ `https://frisbii.fly.dev/ipfs/${ KNOWN_CID } ?dag-scope=block` ] )
78
78
} )
79
79
80
80
/* Disabled as long as we are fetching the top-level block only
81
81
test('fetchCAR exceeding MAX_CAR_SIZE', async () => {
82
- const URL = 'url'
83
82
const fetch = async url => {
84
83
return {
85
84
status: 200,
@@ -99,7 +98,7 @@ test('fetchCAR exceeding MAX_CAR_SIZE', async () => {
99
98
carChecksum: null,
100
99
statusCode: null
101
100
}
102
- await spark.fetchCAR('http', '/ipv4 /127.0.0.1/tcp/80/http', 'bafy', stats)
101
+ await spark.fetchCAR('http', '/ip4 /127.0.0.1/tcp/80/http', 'bafy', stats)
103
102
assertEquals(stats.timeout, false)
104
103
assertEquals(stats.carTooLarge, true)
105
104
assertEquals(stats.byteLength, MAX_CAR_SIZE + 1)
0 commit comments