mirror of https://gitgud.io/fatchan/jschan.git
use env var for the docker password, run the tests, remove docker jschan-test (was broken) some changes to test folder, to run the suites in ordermerge-requests/341/head
parent
f41a84c944
commit
19dcab2016
8 changed files with 57 additions and 44 deletions
@ -1,23 +0,0 @@ |
||||
FROM node:16 |
||||
|
||||
RUN apt-get update -y |
||||
RUN apt-get install ffmpeg imagemagick graphicsmagick -y |
||||
|
||||
WORKDIR /opt |
||||
|
||||
COPY . . |
||||
|
||||
RUN npm install |
||||
|
||||
RUN npm install -g pm2 gulp |
||||
|
||||
COPY ./docker/jschan/secrets.js ./configs/secrets.js |
||||
|
||||
#i fucking hate docker |
||||
ENV MONGO_USERNAME jschan |
||||
ENV MONGO_PASSWORD changeme |
||||
ENV REDIS_PASSWORD changeme |
||||
|
||||
RUN gulp generate-favicon |
||||
|
||||
CMD ["npm", "run", "test"] |
@ -0,0 +1,5 @@ |
||||
describe('run integration tests', () => { |
||||
require('./setup.js')(); |
||||
require('./posting.js')(); |
||||
require('./pages.js')(); |
||||
}) |
@ -1,6 +1,6 @@ |
||||
const fetch = require('node-fetch'); |
||||
|
||||
describe('Test loading dynamic pages', () => { |
||||
module.exports = () => describe('Test loading dynamic pages', () => { |
||||
|
||||
test('/boards.html', async () => { |
||||
const response = await fetch('http://localhost/boards.html'); |
@ -1,6 +1,6 @@ |
||||
const fetch = require('node-fetch'); |
||||
|
||||
describe('Test posting', () => { |
||||
module.exports = () => describe('Test posting', () => { |
||||
|
||||
let threadId; |
||||
test('post new thread', async () => { |
@ -0,0 +1,41 @@ |
||||
const fetch = require('node-fetch'); |
||||
|
||||
module.exports = () => describe('login and create test board', () => { |
||||
|
||||
let sessionCookie; |
||||
|
||||
test('login as admin', async () => { |
||||
const params = new URLSearchParams(); |
||||
params.append('username', 'admin'); |
||||
params.append('password', process.env.TEST_ADMIN_PASSWORD); |
||||
const response = await fetch('http://localhost/forms/login', { |
||||
headers: { |
||||
'x-using-xhr': 'true', |
||||
}, |
||||
method: 'POST', |
||||
body: params, |
||||
redirect: 'manual', |
||||
}); |
||||
const rawHeaders = response.headers.raw(); |
||||
expect(rawHeaders['set-cookie']).toBeDefined(); |
||||
expect(rawHeaders['set-cookie'][0]).toMatch(/^connect\.sid/); |
||||
sessionCookie = rawHeaders['set-cookie'][0]; |
||||
}); |
||||
|
||||
test('create test board', async () => { |
||||
const params = new URLSearchParams(); |
||||
params.append('uri', 'test'); |
||||
params.append('name', 'test'); |
||||
const response = await fetch('http://localhost/forms/create', { |
||||
headers: { |
||||
'x-using-xhr': 'true', |
||||
'cookie': sessionCookie, |
||||
}, |
||||
method: 'POST', |
||||
body: params, |
||||
redirect: 'manual', |
||||
}); |
||||
expect([302, 409]).toContain(response.status) |
||||
}); |
||||
|
||||
}); |
Loading…
Reference in new issue