Skip to content

Commit

Permalink
Harmonize test
Browse files Browse the repository at this point in the history
  • Loading branch information
guimard committed Aug 16, 2024
1 parent 8928d20 commit 7aa5760
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion uwsgi-portal/__test__/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ RUN mkdir /test

COPY *.test.js /test/

CMD [ "mocha", "-t", "30000", "/test/*.test.js" ]
CMD [ "mocha", "--exit", "-t", "30000", "/test/*.test.js" ]
14 changes: 13 additions & 1 deletion uwsgi-portal/__test__/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
version: "3.4"

services:
relay:
image: yadd/relay-test
build:
context: ./server
networks:
uportaltest:
aliases:
- relay.example.com

auth.example.com:
container_name: test_portal_with_supertest
image: yadd/lemonldap-ng-portal
environment:
- LOGGER=stderr
- USERLOGGER=stderr
- "RELAY=foo.example.com=http://auth.example.com/static/"
- "RELAY=foo.example.com=http://relay.example.com:3000/"
depends_on:
relay:
condition: service_started
networks:
uportaltest:
aliases:
Expand Down
10 changes: 7 additions & 3 deletions uwsgi-portal/__test__/portal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,14 @@ describe('LLNG portal', () => {
})
describe('RELAY', () => {
const request = supertest.agent('http://foo.example.com')
it('should find /languages/fr.json', (done) => {
request.get('/languages/fr.json')
it('should find http://foo.example.com/', (done) => {
request.get('/')
.set('Accept', 'application/json')
.expect(200)
.then(res => { done() })
.expect({name:'john'})
.then(res => {
done();
})
.catch(done)
});
})
7 changes: 7 additions & 0 deletions uwsgi-portal/__test__/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM debian:bookworm-slim

RUN apt-get update && apt-get upgrade -y && apt-get install -y node-express

COPY index.js /

CMD ["node","/index.js"]
9 changes: 9 additions & 0 deletions uwsgi-portal/__test__/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/node

const express = require('express');

const app = express();
app.get('/', function (req, res) {
res.status(200).json({ name: 'john' });
})
app.listen(3000)

0 comments on commit 7aa5760

Please sign in to comment.