ソースを参照

load last profile for one minute

pull/342/head
Guillaume Vincent 7年前
コミット
cdf48982cb
2個のファイルの変更7行の追加7行の削除
  1. +1
    -1
      src/store/mutations.js
  2. +6
    -6
      test/store.mutations.js

+ 1
- 1
src/store/mutations.js ファイルの表示

@@ -49,7 +49,7 @@ export default {
}
},
[types.LOAD_PASSWORD_FIRST_TIME](state){
const tenMinutesAgo = new Date().getTime() - 10 * 60 * 1000;
const tenMinutesAgo = new Date().getTime() - 60 * 1000;
if (tenMinutesAgo > state.lastUse) {
setState(state, 'password', state.defaultPassword);
}


+ 6
- 6
test/store.mutations.js ファイルの表示

@@ -159,13 +159,13 @@ test('SET_VERSION password null', t => {
t.is(state.password.version, 2);
});

test('LOAD_PASSWORD_FIRST_TIME 5 minutes after last use', t => {
test('LOAD_PASSWORD_FIRST_TIME 30 seconds after last use', t => {
const now = 1485989236000;
const time = new Date(now);
timekeeper.freeze(time);
const fiveMinutesBefore = now - 5 * 60 * 1000;
const thirtySecondBefore = now - 30 * 1000;
const state = {
lastUse: fiveMinutesBefore,
lastUse: thirtySecondBefore,
password: {
login: 'test@example.org',
length: 30
@@ -182,13 +182,13 @@ test('LOAD_PASSWORD_FIRST_TIME 5 minutes after last use', t => {
timekeeper.reset();
});

test('LOAD_PASSWORD_FIRST_TIME more than 10 minutes after last use', t => {
test('LOAD_PASSWORD_FIRST_TIME more than 1 minute after last use', t => {
const now = 1485989236000;
const time = new Date(now);
timekeeper.freeze(time);
const twentyMinutesBefore = now - 20 * 60 * 1000;
const oneMinuteAndOneSecond = now - 61 * 1000;
const state = {
lastUse: twentyMinutesBefore,
lastUse: oneMinuteAndOneSecond,
password: {
login: 'test@example.org',
length: 30


読み込み中…
キャンセル
保存