<commit_before>/// <reference path="../typings/index.d.ts" />

/**
 * Copyright 2016 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * Limitations under the License.
 */

import factory, * as Cb from '../src'

const CONFIG: Cb.Config = { url: 'url', agent: 'id' }

describe('cryptobox module', function () {
  it('exports a function', function () {
    expect(typeof factory).toBe("function")
  })

  describe('exported function', function () {
    describe('requires a mandatory config: { url: string, id: string } argument',
    function () {
      let mandatory: Cb.Config

      beforeEach(function () {
        mandatory = CONFIG
      })

      it('accepts a config: { url: string, id: string } argument', function () {
        expect(() => factory(mandatory)).not.toThrowError()
      })

      it('throws when missing', function () {
        expect(factory).toThrowError('invalid argument')
      })

      it('throws when not an object', function () {
        Object.keys(TYPES)
        .filter(key => key !== 'Object')<commit_msg>change config.id to config.agent in spec strings<commit_after>/// <reference path="../typings/index.d.ts" />

/**
 * Copyright 2016 <NAME>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * Limitations under the License.
 */

import factory, * as Cb from '../src'

const CONFIG: Cb.Config = { url: 'url', agent: 'id' }

describe('cryptobox module', function () {
  it('exports a function', function () {
    expect(typeof factory).toBe("function")
  })

  describe('exported function', function () {
    describe('requires a mandatory config: { url: string, agent: string } argument',
    function () {
      let mandatory: Cb.Config

      beforeEach(function () {
        mandatory = CONFIG
      })

      it('accepts a config: { url: string, agent: string } argument', function () {
        expect(() => factory(mandatory)).not.toThrowError()
      })

      it('throws when missing', function () {
        expect(factory).toThrowError('invalid argument')
      })

      it('throws when not an object', function () {
        Object.keys(TYPES)
        .filter(key => key !== 'Object')
{'fraction_non_alphanumeric': 0.12699446434386194, 'fraction_numerical': 0.005210029306414849, 'mean_word_length': 3.213991769547325, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1269817', 'n_tokens_mistral': 837, 'n_tokens_neox': 810, 'n_words': 309}