summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/auth/saml.js
blob: b8c21f649edc096daa8f5524eb97232278e80cca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const requireInject = require('require-inject')
const { test } = require('tap')

test('saml login', (t) => {
  t.plan(3)
  const samlOpts = {
    creds: {},
    registry: 'https://diff-registry.npmjs.org/',
    scope: 'myscope',
  }

  const npm = {
    config: {
      set: (key, value) => {
        t.equal(key, 'sso-type', 'should define sso-type')
        t.equal(value, 'saml', 'should set sso-type to saml')
      },
    },
  }
  const saml = requireInject('../../../lib/auth/saml.js', {
    '../../../lib/auth/sso.js': (npm, opts) => {
      t.equal(opts, samlOpts, 'should forward opts')
    },
  })

  saml(npm, samlOpts)

  t.end()
})