Skip to content

Commit fc46243

Browse files
committed
fixup! simplify unit test
Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
1 parent 50326d3 commit fc46243

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

test/spark.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test('fetchCAR', async () => {
5252
const requests = []
5353
const mockedFetch = async url => {
5454
requests.push(url.toString())
55-
return fetch(`https://frisbii.fly.dev/ipfs/${KNOWN_CID}`)
55+
return fetch(url)
5656
}
5757
const spark = new Spark({ fetch: mockedFetch })
5858
const stats = {
@@ -65,21 +65,20 @@ test('fetchCAR', async () => {
6565
carChecksum: null,
6666
statusCode: null
6767
}
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')
6970
assertEquals(stats.timeout, false, 'stats.timeout')
7071
assertInstanceOf(stats.startAt, Date)
7172
assertInstanceOf(stats.firstByteAt, Date)
7273
assertInstanceOf(stats.endAt, Date)
7374
assertEquals(stats.carTooLarge, false, 'stats.carTooLarge')
7475
assertEquals(stats.byteLength, 200, 'stats.byteLength')
7576
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`])
7878
})
7979

8080
/* Disabled as long as we are fetching the top-level block only
8181
test('fetchCAR exceeding MAX_CAR_SIZE', async () => {
82-
const URL = 'url'
8382
const fetch = async url => {
8483
return {
8584
status: 200,
@@ -99,7 +98,7 @@ test('fetchCAR exceeding MAX_CAR_SIZE', async () => {
9998
carChecksum: null,
10099
statusCode: null
101100
}
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)
103102
assertEquals(stats.timeout, false)
104103
assertEquals(stats.carTooLarge, true)
105104
assertEquals(stats.byteLength, MAX_CAR_SIZE + 1)

0 commit comments

Comments
 (0)