-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: miss-match session key/secret error (#53)
- Loading branch information
1 parent
e70a032
commit 47ef4b8
Showing
3 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { expect } from 'chai'; | ||
import { randomBytes } from 'crypto'; | ||
import fetch from 'isomorphic-fetch'; | ||
|
||
import encrypt from '../../../src/packages/session/utils/encrypt'; | ||
import config from '../../test-app/config/environments/test.json'; | ||
|
||
const host = 'http://localhost:4000'; | ||
|
||
describe('Unit: class Session ', () => { | ||
describe('Regression: #updateCookie() (https://github.com/postlight/lux/issues/50)', () => { | ||
it('defaults to empty session upon a decryption error', async () => { | ||
const session = encrypt('{}', randomBytes(32).toString('hex')); | ||
const { status, headers } = await fetch(`${host}/posts`, { | ||
headers: new Headers({ | ||
'Cookie': `${config.sessionKey}=${session};` | ||
}) | ||
}); | ||
|
||
expect(status).to.equal(200); | ||
}); | ||
}); | ||
}); |