Skip to content

Commit e3bca27

Browse files
authored
test(save): to enable renovate automerging feature (#27)
1 parent 2353774 commit e3bca27

File tree

5 files changed

+73
-1
lines changed

5 files changed

+73
-1
lines changed

.circleci/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,6 @@ jobs:
1818
- run:
1919
name: test
2020
command: |
21+
docker-compose exec -u root api mkdir -p data/audio
22+
docker-compose exec -u root api chown -R node:node data
2123
docker-compose exec api npm run test

api/config/endpoint.test.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
describe(`endpoint config`, () => {
2+
beforeEach(() => {
3+
jest.resetModules();
4+
process.env = {};
5+
});
6+
7+
it(`returns endpoint config with disabled endpoints when no env vars`, () => {
8+
process.env = {};
9+
10+
expect(require('./endpoint')).toEqual({
11+
save: {
12+
enabled: false,
13+
},
14+
stream: {
15+
enabled: false,
16+
},
17+
slack: {
18+
enabled: false,
19+
},
20+
});
21+
});
22+
23+
it(`returns endpoint config with enabled endpoints when all env vars are "true"`, () => {
24+
process.env = {
25+
...process.env,
26+
ENDPOINT_SAVE_ENABLED: 'true',
27+
ENDPOINT_STREAM_ENABLED: 'true',
28+
ENDPOINT_SLACK_ENABLED: 'true',
29+
};
30+
31+
expect(require('./endpoint')).toEqual({
32+
save: {
33+
enabled: true,
34+
},
35+
stream: {
36+
enabled: true,
37+
},
38+
slack: {
39+
enabled: true,
40+
},
41+
});
42+
});
43+
});

api/src/router/save.e2e-test.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,27 @@ const request = require('supertest');
22
const app = require('../../src/app');
33

44
describe(`GET /save`, () => {
5-
it(`returns 400 if missing "url" query param`, () => {
5+
it(`returns 400 if missing "url" query param`, (done) => {
66
return request(app)
77
.get('/save')
88
.expect(400)
99
.expect(response => {
1010
expect(response.body.message).toBe('Missing required query params "url"');
1111
})
12+
.end(done)
13+
;
14+
});
15+
16+
it(`redirects with 301 to blindtest URL when available`, (done) => {
17+
jest.setTimeout(30000);
18+
19+
return request(app)
20+
.get('/save?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ')
21+
.expect(301)
22+
.expect(response => {
23+
expect(response.headers.location).toMatch('http://localhost:3030/stream/');
24+
})
25+
.end(done)
1226
;
1327
});
1428
});

docker-compose.local.ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ version: '3'
22

33
services:
44
api:
5+
environment:
6+
NODE_APP_DIR: /home/node/app
7+
DATABASE_TYPE: json
8+
DATABASE_JSON_TYPE: filesystem
9+
DATABASE_JSON_FILESYSTEM_PATH: /home/node/app/data/database.json
10+
FILES_STORAGE_TYPE: filesystem
11+
FILES_STORAGE_FILESYSTEM_PATH: /home/node/app/data/audio
512
build:
613
args:
714
SET_DEVELOPMENT_NODE_ENV: 1

renovate.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,11 @@
88
"depNameTemplate": "ytdl-org/youtube-dl",
99
"versioningTemplate": "loose"
1010
}
11+
],
12+
"packageRules": [
13+
{
14+
"managers": ["regex"],
15+
"automerge": true
16+
}
1117
]
1218
}

0 commit comments

Comments
 (0)