@@ -31,26 +31,33 @@ const testJson = `
31
31
const base = 'https://f-droid.org/api/v1'
32
32
const path = `/packages/${ testPkg } `
33
33
34
- t . create ( 'Package is found' )
34
+ t . create ( 'f-droid.org: Package is found' )
35
35
. get ( `/v/${ testPkg } .json` )
36
36
. intercept ( nock => nock ( base ) . get ( path ) . reply ( 200 , testJson ) )
37
37
. expectBadge ( { label : 'f-droid' , message : 'v0.2.7' } )
38
38
39
- t . create ( 'Package is found (pre-release)' )
39
+ t . create ( 'f-droid.org: Package is found (pre-release)' )
40
40
. get ( `/v/${ testPkg } .json?include_prereleases` )
41
41
. intercept ( nock => nock ( base ) . get ( path ) . reply ( 200 , testJson ) )
42
42
. expectBadge ( { label : 'f-droid' , message : 'v0.2.11' } )
43
43
44
- t . create ( 'Package is not found with 403' )
44
+ t . create ( 'f-droid.org: Package is not found with 403' )
45
45
. get ( `/v/${ testPkg } .json` )
46
46
. intercept ( nock => nock ( base ) . get ( path ) . reply ( 403 , 'some 403 text' ) )
47
47
. expectBadge ( { label : 'f-droid' , message : 'app not found' } )
48
48
49
- t . create ( 'Package is not found with 404' )
49
+ t . create ( 'f-droid.org: Package is not found with 404' )
50
50
. 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
+ )
51
56
. expectBadge ( { label : 'f-droid' , message : 'app not found' } )
52
57
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
+ )
54
61
. get ( `/v/${ testPkg } .json` )
55
62
. intercept ( nock =>
56
63
nock ( base )
@@ -59,17 +66,78 @@ t.create('Package is not found with no packages available (empty array)"')
59
66
)
60
67
. expectBadge ( { label : 'f-droid' , message : 'no packages found' } )
61
68
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
+ )
63
72
. get ( `/v/${ testPkg } .json` )
64
73
. intercept ( nock =>
65
74
nock ( base ) . get ( path ) . reply ( 200 , `{"packageName":"${ testPkg } "}` ) ,
66
75
)
67
76
. expectBadge ( { label : 'f-droid' , message : 'no packages found' } )
68
77
69
78
/* 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' )
71
80
. get ( '/v/org.thosp.yourlocalweather.json' )
72
81
. expectBadge ( {
73
82
label : 'f-droid' ,
74
83
message : isVPlusDottedVersionAtLeastOne ,
75
84
} )
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