Skip to content

Commit

Permalink
chore: remove unneeded otplease mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Apr 4, 2022
1 parent e3da5df commit 31a0218
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 25 deletions.
11 changes: 0 additions & 11 deletions test/lib/auth/sso.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ const sso = t.mock('../../../lib/auth/sso.js', {
)
}
},
'../../../lib/utils/otplease.js': (opts, fn) => {
if (opts) {
return fn({ ...opts, otp: '1234' })
} else {
throw Object.assign(
new Error('failed retrieving otp'),
{ code: 'ERROR' }
)
}
},
})

const npm = {
Expand Down Expand Up @@ -75,7 +65,6 @@ t.test('simple login', async (t) => {
opts,
{
creds: {},
otp: '1234',
registry: 'https://registry.npmjs.org/',
scope: '',
ssoType: 'oauth',
Expand Down
1 change: 0 additions & 1 deletion test/lib/commands/deprecate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ npmFetch.json = async (uri, opts) => {

const Deprecate = t.mock('../../../lib/commands/deprecate.js', {
'../../../lib/utils/get-identity.js': async () => getIdentityImpl(),
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
libnpmaccess: {
lsPackages: async () => ({ foo: 'write', bar: 'write', baz: 'write', buzz: 'read' }),
},
Expand Down
1 change: 0 additions & 1 deletion test/lib/commands/hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ const libnpmhook = {
}

const Hook = t.mock('../../../lib/commands/hook.js', {
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
libnpmhook,
})
const hook = new Hook(npm)
Expand Down
1 change: 0 additions & 1 deletion test/lib/commands/org.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const libnpmorg = {
}

const Org = t.mock('../../../lib/commands/org.js', {
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
libnpmorg,
})
const org = new Org(npm)
Expand Down
3 changes: 0 additions & 3 deletions test/lib/commands/owner.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ const mocks = {
'proc-log': log,
'npm-registry-fetch': npmFetch,
pacote,
'../../../lib/utils/otplease.js': async (opts, fn) => fn({ otp: '123456', opts }),
'../../../lib/utils/read-package-name.js': async (prefix) => {
readPackageNamePrefix = prefix
return readPackageNameResponse
Expand Down Expand Up @@ -193,7 +192,6 @@ t.test('owner add <user> <pkg>', async t => {
_rev: '1-foobaaa1',
maintainers: npmcliMaintainers,
},
otp: '123456',
spec: {
name: '@npmcli/map-workspaces',
},
Expand Down Expand Up @@ -507,7 +505,6 @@ t.test('owner rm <user> <pkg>', async t => {
body: {
_rev: '1-foobaaa1',
},
otp: '123456',
spec: {
name: '@npmcli/map-workspaces',
},
Expand Down
4 changes: 0 additions & 4 deletions test/lib/commands/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ const mocks = {
.join('\n')
}
},
'../../../lib/utils/pulse-till-done.js': {
withPromise: async a => a,
},
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
'../../../lib/utils/read-user-info.js': {
async password () {},
async otp () {},
Expand Down
1 change: 0 additions & 1 deletion test/lib/commands/team.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const npm = mockNpm({
const mocks = {
libnpmteam,
'cli-columns': a => a.join(' '),
'../../../lib/utils/otplease.js': async (opts, fn) => fn(opts),
}

t.afterEach(() => {
Expand Down
3 changes: 0 additions & 3 deletions test/lib/commands/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ const npm = {
}

const mockToken = (otherMocks) => t.mock('../../../lib/commands/token.js', {
'../../../lib/utils/otplease.js': (opts, fn) => {
return Promise.resolve().then(() => fn(opts))
},
'../../../lib/utils/read-user-info.js': mocks.readUserInfo,
'npm-profile': mocks.profile,
...otherMocks,
Expand Down

0 comments on commit 31a0218

Please sign in to comment.