Skip to content

Commit

Permalink
fix: missing defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
seekayel committed Nov 30, 2022
1 parent 06ce678 commit dd97c4b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/CyclicSessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const { PutCommand, GetCommand, DeleteCommand } = require("@aws-sdk/lib-dynamodb
// @flow

const {
DEFAULT_CALLBACK,
DEFAULT_HASH_KEY,
DEFAULT_HASH_PREFIX,
DEFAULT_SORT_KEY,
DEFAULT_TTL,
DEFAULT_TOUCH_INTERVAL,
DEFAULT_KEEP_EXPIRED_POLICY,
Expand Down
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// defaults
const DEFAULT_HASH_KEY = 'pk'
const DEFAULT_HASH_PREFIX = 'session-store#'
const DEFAULT_SORT_KEY = 'sk'
const DEFAULT_TTL = 86400000 // 1 day
const DEFAULT_TOUCH_INTERVAL = 30000 // 30 seconds
Expand All @@ -12,6 +13,7 @@ const DEFAULT_KEEP_EXPIRED_POLICY = false

module.exports = {
DEFAULT_HASH_KEY,
DEFAULT_HASH_PREFIX,
DEFAULT_SORT_KEY,
DEFAULT_TTL,
DEFAULT_TOUCH_INTERVAL,
Expand Down
8 changes: 6 additions & 2 deletions test/constants.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import {
DEFAULT_HASH_KEY,
DEFAULT_HASH_PREFIX,
DEFAULT_SORT_KEY,
DEFAULT_TTL,
DEFAULT_TOUCH_INTERVAL,
DEFAULT_KEEP_EXPIRED_POLICY,
} from '../src/constants';

describe('constants', () => {
it('should have all the constants', () => {
expect(DEFAULT_TOUCH_INTERVAL).toBeDefined();
expect(DEFAULT_TTL).toBeDefined();
expect(DEFAULT_HASH_KEY).toBeDefined();
expect(DEFAULT_HASH_PREFIX).toBeDefined();
expect(DEFAULT_SORT_KEY).toBeDefined();
expect(DEFAULT_TTL).toBeDefined();
expect(DEFAULT_TOUCH_INTERVAL).toBeDefined();
expect(DEFAULT_KEEP_EXPIRED_POLICY).toBeDefined();
});
});

0 comments on commit dd97c4b

Please sign in to comment.