blob: f5b9792a2bf5162e18504ab947e0379065fc1cc8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
/**
* @jest-environment node
*/
import request from 'supertest'
import { app } from '../app'
describe('Releases helper', () => {
it('Should respond with empty array to unknown user agents', async () => {
return request(app)
.get('/api/apps/android/releases')
.expect(200)
.then(response => {
expect(response.body).toStrictEqual([])
})
})
it('Should respond with a single legacy version data to old Android app', async () => {
return request(app)
.get('/api/apps/android/releases')
.set('User-Agent', 'Juick/100 okhttp/3.12 Android/19')
.expect(200)
.then(response => {
expect(response.body.length).toBe(1)
expect(response.body[0].name).toBe('3.1.216')
})
})
it('Should redirect to Github when Android version is ok', async () => {
return request(app)
.get('/api/apps/android/releases')
.set('User-Agent', 'Juick/100 okhttp/3.12 Android/24')
.expect(302)
.then(response => {
expect(response.redirect).toBe(true)
})
})
})
|