diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-05-11 10:46:24 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-05-11 10:46:24 -0400 |
| commit | 8ccb0d93cdc064776454c929e15aa03129be37a3 (patch) | |
| tree | 109dd4fd595f15d25d2b3b27682c776123290ea2 /backend/__tests__/user.test.js | |
| parent | 632af35d8a0871ca8c1041d0e14d63e2b457d168 (diff) | |
clean up
Diffstat (limited to 'backend/__tests__/user.test.js')
| -rw-r--r-- | backend/__tests__/user.test.js | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/backend/__tests__/user.test.js b/backend/__tests__/user.test.js deleted file mode 100644 index f73ed79..0000000 --- a/backend/__tests__/user.test.js +++ /dev/null @@ -1,42 +0,0 @@ -import { SIGNUP_MUTATION } from '../../frontend/queries/index'; -import { print } from 'graphql/language/printer'; - -const { request } = require('graphql-request'); -const createServer = require('../src/createServer'); - -let server; -const port = 2342; -const endpoint = `http://localhost:${port}`; - -beforeAll(async () => { - server = await createServer().start({ port }); -}); - -afterAll(async () => { - server.close(); -}); - -describe('User C.R.U.D. Operations', () => { - const email = `wes${Date.now()}@gmail.com`; - - it('Creates a user', async () => { - const { signup } = await request(endpoint, print(SIGNUP_MUTATION), { - name: 'Wes Bos', - email, - password: 'test', - }); - expect(signup.token).toBeTruthy(); - expect(signup.user.name).toBe('Wes Bos'); - expect(signup.user.email).toBe(email); - }); - - it('throws an error with a duplicate signup', async () => - request(endpoint, print(SIGNUP_MUTATION), { - name: 'wes bos', - email, - password: 'test', - }).catch(err => { - expect(err.message).toContain('A unique constraint would be violated on User.'); - console.log(err.message); - })); -}); |
