Skip to content

Commit 9e935be

Browse files
committed
test: update F-Droid tests
1 parent 65e7f21 commit 9e935be

File tree

1 file changed

+75
-7
lines changed

1 file changed

+75
-7
lines changed

services/f-droid/f-droid.tester.js

+75-7
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,33 @@ const testJson = `
3131
const base = 'https://f-droid.org/api/v1'
3232
const path = `/packages/${testPkg}`
3333

34-
t.create('Package is found')
34+
t.create('f-droid.org: Package is found')
3535
.get(`/v/${testPkg}.json`)
3636
.intercept(nock => nock(base).get(path).reply(200, testJson))
3737
.expectBadge({ label: 'f-droid', message: 'v0.2.7' })
3838

39-
t.create('Package is found (pre-release)')
39+
t.create('f-droid.org: Package is found (pre-release)')
4040
.get(`/v/${testPkg}.json?include_prereleases`)
4141
.intercept(nock => nock(base).get(path).reply(200, testJson))
4242
.expectBadge({ label: 'f-droid', message: 'v0.2.11' })
4343

44-
t.create('Package is not found with 403')
44+
t.create('f-droid.org: Package is not found with 403')
4545
.get(`/v/${testPkg}.json`)
4646
.intercept(nock => nock(base).get(path).reply(403, 'some 403 text'))
4747
.expectBadge({ label: 'f-droid', message: 'app not found' })
4848

49-
t.create('Package is not found with 404')
49+
t.create('f-droid.org: Package is not found with 404')
5050
.get('/v/io.shiels.does.not.exist.json')
51+
.intercept(nock =>
52+
nock(base)
53+
.get('/packages/io.shiels.does.not.exist')
54+
.reply(404, 'some 404 text'),
55+
)
5156
.expectBadge({ label: 'f-droid', message: 'app not found' })
5257

53-
t.create('Package is not found with no packages available (empty array)"')
58+
t.create(
59+
'f-droid.org: Package is not found with no packages available (empty array)"',
60+
)
5461
.get(`/v/${testPkg}.json`)
5562
.intercept(nock =>
5663
nock(base)
@@ -59,17 +66,78 @@ t.create('Package is not found with no packages available (empty array)"')
5966
)
6067
.expectBadge({ label: 'f-droid', message: 'no packages found' })
6168

62-
t.create('Package is not found with no packages available (missing array)"')
69+
t.create(
70+
'f-droid.org: Package is not found with no packages available (missing array)"',
71+
)
6372
.get(`/v/${testPkg}.json`)
6473
.intercept(nock =>
6574
nock(base).get(path).reply(200, `{"packageName":"${testPkg}"}`),
6675
)
6776
.expectBadge({ label: 'f-droid', message: 'no packages found' })
6877

6978
/* If this test fails, either the API has changed or the app was deleted. */
70-
t.create('The real api did not change')
79+
t.create('f-droid.org: The real api did not change')
7180
.get('/v/org.thosp.yourlocalweather.json')
7281
.expectBadge({
7382
label: 'f-droid',
7483
message: isVPlusDottedVersionAtLeastOne,
7584
})
85+
86+
const base2 = 'https://apt.izzysoft.de/fdroid/api/v1'
87+
const path2 = `/packages/${testPkg}`
88+
89+
t.create('custom repo: Package is found')
90+
.get(`/v/${testPkg}.json?serverFqdn=apt.izzysoft.de&endpoint=fdroid`)
91+
.intercept(nock => nock(base2).get(path2).reply(200, testJson))
92+
.expectBadge({ label: 'f-droid', message: 'v0.2.7' })
93+
94+
t.create('custom repo: Package is found (pre-release)')
95+
.get(
96+
`/v/${testPkg}.json?serverFqdn=apt.izzysoft.de&endpoint=fdroid&include_prereleases`,
97+
)
98+
.intercept(nock => nock(base2).get(path2).reply(200, testJson))
99+
.expectBadge({ label: 'f-droid', message: 'v0.2.11' })
100+
101+
t.create('custom repo: Package is not found with 403')
102+
.get(`/v/${testPkg}.json?serverFqdn=apt.izzysoft.de&endpoint=fdroid`)
103+
.intercept(nock => nock(base2).get(path2).reply(403, 'some 403 text'))
104+
.expectBadge({ label: 'f-droid', message: 'app not found' })
105+
106+
t.create('custom repo: Package is not found with 404')
107+
.get(
108+
'/v/io.shiels.does.not.exist.json?serverFqdn=apt.izzysoft.de&endpoint=fdroid',
109+
)
110+
.intercept(nock =>
111+
nock(base2)
112+
.get('/packages/io.shiels.does.not.exist')
113+
.reply(404, 'some 404 text'),
114+
)
115+
.expectBadge({ label: 'f-droid', message: 'app not found' })
116+
117+
t.create(
118+
'custom repo: Package is not found with no packages available (empty array)"',
119+
)
120+
.get(`/v/${testPkg}.json?serverFqdn=apt.izzysoft.de&endpoint=fdroid`)
121+
.intercept(nock =>
122+
nock(base2)
123+
.get(path2)
124+
.reply(200, `{"packageName":"${testPkg}","packages":[]}`),
125+
)
126+
.expectBadge({ label: 'f-droid', message: 'no packages found' })
127+
128+
t.create(
129+
'custom repo: Package is not found with no packages available (missing array)"',
130+
)
131+
.get(`/v/${testPkg}.json?serverFqdn=apt.izzysoft.de&endpoint=fdroid`)
132+
.intercept(nock =>
133+
nock(base2).get(path2).reply(200, `{"packageName":"${testPkg}"}`),
134+
)
135+
.expectBadge({ label: 'f-droid', message: 'no packages found' })
136+
137+
/* If this test fails, either the API has changed or the app was deleted. */
138+
t.create('custom repo: The real api did not change')
139+
.get('/v/com.looker.droidify.json')
140+
.expectBadge({
141+
label: 'f-droid',
142+
message: isVPlusDottedVersionAtLeastOne,
143+
})

0 commit comments

Comments
 (0)