<commit_before>'use strict'

/**
 * Test dependencies
 */
const cwd = process.cwd()
const path = require('path')
const chai = require('chai')

/**
 * Assertions
 */
chai.should()
let expect = chai.expect

/**
 * Code under test
 */
const formats = require('../src/Formats')
const Formats = formats.constructor

/**
 * Tests
 */
describe('Formats', () => {
  describe('module', () => {
    it('should be an instance of Formats', () => {
      expect(formats).to.be.instanceof(Formats)
    })
  })

  describe('initialize', () => {
    it('should return an instance of Formats', () => {
      Formats.initialize().should.be.instanceof(Formats)
    })
  })

  describe('register', () => {
    it('should require "name" argument to be a string', () => {
      expect(() => {
        formats.register(null)
      }).to.throw('Format name must be a string')
    })

    it('should validate pattern is allowed by JSON Schema patterns')

    it('should add the pattern to the map', () => {
      formats.register('ends-with-foo', /foo$/)
      formats.get('ends-with-foo').should.be.instanceof(RegExp)
    })
  })

  describe('resolve', () => {
    it('should return a known pattern', () => {
      formats.resolve('uri').should.be.instanceof(RegExp)
    })

    it('should throw an error with unknown pattern', () => {
      expect(() => {
        formats.resolve('unknown')
      }).to.throw('Unknown JSON Schema format.')
    })
  })

  describe.only('test', () => {
    it('should validate a value with a known known pattern', () => {
      formats.test('uri', '/').should.equal(true)
      formats.test('uri', '&').should.equal(false)
    })

    it('should throw an error with unknown pattern', () => {
      expect(() => {
        formats.test('unknown', 'value')
      }).to.throw('Unknown JSON Schema format.')
    })
  })

  describe('date-time', () => {})
  describe('uri', () => {})
  describe('email', () => {})
  describe('ipv4', () => {})
  describe('ipv6', () => {})
  describe('hostname', () => {})
})
<commit_msg>test(Format): remove test restriction<commit_after>'use strict'

/**
 * Test dependencies
 */
const cwd = process.cwd()
const path = require('path')
const chai = require('chai')

/**
 * Assertions
 */
chai.should()
let expect = chai.expect

/**
 * Code under test
 */
const formats = require('../src/Formats')
const Formats = formats.constructor

/**
 * Tests
 */
describe('Formats', () => {
  describe('module', () => {
    it('should be an instance of Formats', () => {
      expect(formats).to.be.instanceof(Formats)
    })
  })

  describe('initialize', () => {
    it('should return an instance of Formats', () => {
      Formats.initialize().should.be.instanceof(Formats)
    })
  })

  describe('register', () => {
    it('should require "name" argument to be a string', () => {
      expect(() => {
        formats.register(null)
      }).to.throw('Format name must be a string')
    })

    it('should validate pattern is allowed by JSON Schema patterns')

    it('should add the pattern to the map', () => {
      formats.register('ends-with-foo', /foo$/)
      formats.get('ends-with-foo').should.be.instanceof(RegExp)
    })
  })

  describe('resolve', () => {
    it('should return a known pattern', () => {
      formats.resolve('uri').should.be.instanceof(RegExp)
    })

    it('should throw an error with unknown pattern', () => {
      expect(() => {
        formats.resolve('unknown')
      }).to.throw('Unknown JSON Schema format.')
    })
  })

  describe('test', () => {
    it('should validate a value with a known known pattern', () => {
      formats.test('uri', '/').should.equal(true)
      formats.test('uri', '&').should.equal(false)
    })

    it('should throw an error with unknown pattern', () => {
      expect(() => {
        formats.test('unknown', 'value')
      }).to.throw('Unknown JSON Schema format.')
    })
  })

  describe('date-time', () => {})
  describe('uri', () => {})
  describe('email', () => {})
  describe('ipv4', () => {})
  describe('ipv6', () => {})
  describe('hostname', () => {})
})

{'fraction_non_alphanumeric': 0.2076260762607626, 'fraction_numerical': 0.0009840098400984009, 'mean_word_length': 2.9437439379243453, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 49, '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': '7178957', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1258, 'n_words': 273}