* Move / rework is-valid-token * TokenPool: Add allValidTokenIds method * Minor cleanup in server.js
20 lines
631 B
JavaScript
20 lines
631 B
JavaScript
'use strict'
|
|
|
|
const assert = require('assert')
|
|
const { PoolingTokenProvider } = require('./token-provider')
|
|
const isValidGithubToken = require('../services/github/auth/is-valid-token')
|
|
|
|
describe('The token provider', function() {
|
|
describe('toNative', function() {
|
|
it('should return the expected value', function() {
|
|
const tokens = ['1', '2', '3', '4', '5'].map(c => c.repeat(40))
|
|
const provider = new PoolingTokenProvider(isValidGithubToken)
|
|
tokens.forEach(t => provider.addToken(t))
|
|
assert.deepStrictEqual(
|
|
provider.toNative().sort(),
|
|
Array.from(tokens).sort()
|
|
)
|
|
})
|
|
})
|
|
})
|