| 975 | const OTP_ERROR = Object.assign(new Error('One-time password required'), { code: 'EOTP' }) |
| 976 | |
| 977 | const npmProfile = (t) => { |
| 978 | let setCallCount = 0 |
| 979 | return { |
| 980 | async get () { |
| 981 | return userProfile |
| 982 | }, |
| 983 | async set (newProfile) { |
| 984 | setCallCount++ |
| 985 | if (setCallCount === 1) { |
| 986 | throw OTP_ERROR |
| 987 | } else if (setCallCount === 2) { |
| 988 | t.same( |
| 989 | newProfile, |
| 990 | { |
| 991 | tfa: { |
| 992 | password: 'password1234', |
| 993 | mode: 'disable', |
| 994 | }, |
| 995 | }, |
| 996 | 'should send the new info for setting in profile' |
| 997 | ) |
| 998 | } |
| 999 | }, |
| 1000 | } |
| 1001 | } |
| 1002 | |
| 1003 | const readUserInfo = t => ({ |
| 1004 | async password () { |