Fix the tests so they run again

Also make the tests reflect the current reality
This commit is contained in:
R. Tyler Croy 2018-09-11 14:28:46 -07:00
parent f4f4acd8f1
commit d561598d06
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
4 changed files with 15 additions and 6 deletions

View File

@ -6,6 +6,9 @@ JEST=$(PWD)/node_modules/jest/bin/jest.js
SEQUELIZE=$(PWD)/node_modules/sequelize-cli/lib/sequelize
COMPOSE:=./tools/docker-compose
JEST_ARGS=--runInBand --bail --forceExit --detectOpenHandles
all: build check
depends: package.json package-lock.json
@ -15,7 +18,10 @@ build: depends
$(TSC)
check: build depends migrate
$(JEST) --bail
# Running with docker-compose since our tests require a database to be
# present
$(COMPOSE) run --rm node \
/usr/local/bin/node $(JEST) $(JEST_ARGS)
clean:
$(COMPOSE) down || true
@ -43,7 +49,7 @@ watch: migrate
# Running with docker-compose since our tests require a database to be
# present
$(COMPOSE) run --rm node \
/usr/local/bin/node $(JEST) --watchAll --bail --forceExit
/usr/local/bin/node $(JEST) $(JEST_ARGS) --watch
watch-compile:
$(TSC) -w

View File

@ -9,7 +9,7 @@ services:
- 'POSTGRES_DB=uplink_development'
node:
image: node:10-alpine
image: node:10
command: '/usr/local/bin/node $PWD/node_modules/.bin/nodemon build'
working_dir: $PWD
environment:

View File

@ -27,12 +27,15 @@ describe('Acceptance tests for /evetns', () => {
json: true,
resolveWithFullResponse: true,
}).then(response =>
expect(response.statusCode).toEqual(200)
expect(response.statusCode).toEqual(401)
).catch(err =>
expect(err.statusCode).toEqual(401)
);
});
it('POST /events should allow creating a valid event', () => {
return request(getUrl('/events'), {
method: 'POST',
json: true,
resolveWithFullResponse: true,
body: {
@ -43,7 +46,7 @@ describe('Acceptance tests for /evetns', () => {
correlator: '0xdeadbeef',
},
}).then(response =>
expect(response.statusCode).toEqual(200)
expect(response.statusCode).toEqual(201)
);
});
});

View File

@ -25,5 +25,5 @@ exec docker run --rm ${TTY_ARGS} --net host \
-e LANG=C.UTF-8 \
-e LOG_LEVEL=$LOG_LEVEL \
$(printenv | grep -i \^node | awk '{ print "-e", $1 }') \
node:10-alpine \
node:10 \
${COMMAND}