mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-15 00:59:09 +00:00
add sessions/state spec
This commit is contained in:
parent
e51ca63e1c
commit
bbc0053383
1 changed files with 25 additions and 0 deletions
25
packages/api/src/sessions/state.spec.ts
Normal file
25
packages/api/src/sessions/state.spec.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { parseEnvironment } from '../utils/config';
|
||||
import { getBindings } from '../utils/testHelpers';
|
||||
import { getStateSession, setupStateSession } from './state';
|
||||
|
||||
it('creates and fetches a state session', async () => {
|
||||
const config = parseEnvironment(getBindings());
|
||||
|
||||
const stateID = await setupStateSession(config, {
|
||||
test: 'test-data',
|
||||
});
|
||||
|
||||
const stateSession = await getStateSession(config, stateID);
|
||||
|
||||
expect(stateSession).toEqual({
|
||||
test: 'test-data',
|
||||
});
|
||||
});
|
||||
|
||||
it('returns undefined when state is invalid', async () => {
|
||||
const config = parseEnvironment(getBindings());
|
||||
|
||||
const stateSession = await getStateSession(config, 'invalid-state-id');
|
||||
|
||||
expect(stateSession).toBeUndefined();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue