<commit_before>'use strict'

var t = require('assert')
var qs = require('qs')
var Grant = require('../').express()
var utils = require('../lib/utils')


describe('utils', function () {
  var grant

  before(function () {
    grant = new Grant({
      server: {protocol: 'http', host: 'localhost:5000', callback: '/'},
      concur: {}, elance: {}, facebook: {}, getpocket: {}, twitter: {}, yammer: {}
    })
  })

  describe('redirect_uri', function () {
    it('default', function () {
      t.equal(
        utils.redirect_uri(grant.config.facebook),
        'http://localhost:5000/connect/facebook/callback')
    })
    it('override', function () {
      grant.config.facebook.redirect_uri = 'http://localhost:5000'
      t.equal(
        utils.redirect_uri(grant.config.facebook),
        'http://localhost:5000')
    })
  })

  describe('toQuerystring', function () {<commit_msg>Add path prefix unit test<commit_after>'use strict'

var t = require('assert')
var qs = require('qs')
var Grant = require('../').express()
var utils = require('../lib/utils')


describe('utils', function () {
  var grant

  before(function () {
    grant = new Grant({
      server: {protocol: 'http', host: 'localhost:5000', callback: '/'},
      concur: {}, elance: {}, facebook: {}, getpocket: {}, twitter: {}, yammer: {}
    })
  })

  describe('redirect_uri', function () {
    it('default', function () {
      t.equal(
        utils.redirect_uri(grant.config.facebook),
        'http://localhost:5000/connect/facebook/callback')
    })
    it('path prefix', function () {
      grant.config.facebook.path = '/path/prefix'
      t.equal(
        utils.redirect_uri(grant.config.facebook),
        'http://localhost:5000/path/prefix/connect/facebook/callback')
    })
    it('override', function () {
      grant.config.facebook.redirect_uri = 'http://localhost:5000'
      t.equal(
        utils.redirect_uri(grant.config.facebook),
        'http://localhost:5000')
    })
  })

  describe('toQuerystring', function () {
{'fraction_non_alphanumeric': 0.18756218905472638, 'fraction_numerical': 0.01791044776119403, 'mean_word_length': 3.079107505070994, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2169542', 'n_tokens_mistral': 646, 'n_tokens_neox': 595, 'n_words': 112}