server test changes

This commit is contained in:
Jori Lallo
2016-09-11 12:35:14 -07:00
parent 1b14152291
commit 9b49b45fe7
3 changed files with 12 additions and 6 deletions

View File

@ -1,2 +0,0 @@
DATABASE_URL="postgresql://localhost:5432/atlas"
SEQUELIZE_SECRET=7a947f4b6b5cd4c769029f7b5130c85fe2d3484758c0eeee351cd2e2d2c3bd59

View File

@ -27,8 +27,15 @@
"^.*[.](s?css|css)$": "<rootDir>/__mocks__/styleMock.js",
"^.*[.](gif|ttf|eot|svg)$": "<rootDir>/__test__/fileMock.js"
},
"moduleFileExtensions": ["js", "jsx", "json"],
"moduleDirectories": ["node_modules", "server"],
"moduleFileExtensions": [
"js",
"jsx",
"json"
],
"moduleDirectories": [
"node_modules",
"server"
],
"modulePaths": [
"frontend"
],
@ -133,7 +140,7 @@
"slug": "0.9.1",
"string-hash": "^1.1.0",
"style-loader": "0.13.0",
"truncate-html": "0.0.6",
"truncate-html": "https://github.com/jorilallo/truncate-html/tarball/master",
"url-loader": "0.5.7",
"uuid": "2.0.2",
"validator": "5.2.0",

View File

@ -8,11 +8,11 @@ import { flushdb, seed, sequelize } from '../test/support';
const server = new TestServer(app.callback());
beforeEach(flushdb);
beforeEach(seed);
afterAll(() => server.close());
afterAll(() => sequelize.close());
it('should return known user', async () => {
await seed();
const user = await User.findOne({
where: {
email: 'user1@example.com',
@ -29,6 +29,7 @@ it('should return known user', async () => {
});
it('should require authentication', async () => {
await seed();
const res = await server.post('/api/user.info');
const body = await res.json();