add sessions/state spec

This commit is contained in:
41666 2022-01-28 15:36:27 -05:00
parent e51ca63e1c
commit bbc0053383

View 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();
});