diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:21:47 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:30:18 +0200 |
commit | 0e1dc3e7c69995c691e1dd82e3c2bc68748661ca (patch) | |
tree | f2a4b5cffc72e33c902b67083bbaa35b6f22f0ca /server/tests/api/config.ts | |
parent | b0f9f39ed70299a208d1b388c72de8b7f3510cb7 (diff) | |
download | PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.tar.gz PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.tar.zst PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.zip |
Convert tests to typescript
Diffstat (limited to 'server/tests/api/config.ts')
-rw-r--r-- | server/tests/api/config.ts | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/server/tests/api/config.ts b/server/tests/api/config.ts new file mode 100644 index 000000000..3dda3b4d7 --- /dev/null +++ b/server/tests/api/config.ts | |||
@@ -0,0 +1,50 @@ | |||
1 | /* tslint:disable:no-unused-expression */ | ||
2 | |||
3 | import 'mocha' | ||
4 | import * as chai from 'chai' | ||
5 | const expect = chai.expect | ||
6 | |||
7 | import { | ||
8 | getConfig, | ||
9 | flushTests, | ||
10 | runServer, | ||
11 | registerUser | ||
12 | } from '../utils' | ||
13 | |||
14 | describe('Test config', function () { | ||
15 | let server = null | ||
16 | |||
17 | before(async function () { | ||
18 | this.timeout(120000) | ||
19 | |||
20 | await flushTests() | ||
21 | server = await runServer(1) | ||
22 | }) | ||
23 | |||
24 | it('Should have a correct config on a server with registration enabled', async function () { | ||
25 | const res = await getConfig(server.url) | ||
26 | const data = res.body | ||
27 | |||
28 | expect(data.signup.allowed).to.be.true | ||
29 | }) | ||
30 | |||
31 | it('Should have a correct config on a server with registration enabled and a users limit', async function () { | ||
32 | await registerUser(server.url, 'user1', 'super password') | ||
33 | await registerUser(server.url, 'user2', 'super password') | ||
34 | await registerUser(server.url, 'user3', 'super password') | ||
35 | |||
36 | const res = await getConfig(server.url) | ||
37 | const data = res.body | ||
38 | |||
39 | expect(data.signup.allowed).to.be.false | ||
40 | }) | ||
41 | |||
42 | after(async function () { | ||
43 | process.kill(-server.app.pid) | ||
44 | |||
45 | // Keep the logs if the test failed | ||
46 | if (this['ok']) { | ||
47 | await flushTests() | ||
48 | } | ||
49 | }) | ||
50 | }) | ||