<commit_before>'use strict'

/**
 * Test dependencies
 */
const chai = require('chai')

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

/**
 * Code under test
 */
const SupportedAlgorithms = require('../../src/algorithms/SupportedAlgorithms')

/**
 * Tests
 */
describe('SupportedAlgorithms', () => {
  describe('constructor', () => {
    it('should initialize registers')
  })

  describe('static get operations', () => {
    it('should be an array of operations')
  })

  describe('define', () => {
    it('should register an algorithm for an operation')
  })

  describe('normalize', () => {
    it('should return a registered algorithm for an operation by name')
    it('should throw NotSupportedError for unknown algorithms')
  })
})
<commit_msg>test(SupportedAlgorithms): constructor, operations, define, and normalize methods<commit_after>'use strict'

/**
 * Test dependencies
 */
const chai = require('chai')

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

/**
 * Code under test
 */
const SupportedAlgorithms = require('../../src/algorithms/SupportedAlgorithms')

/**
 * Tests
 */
describe('SupportedAlgorithms', () => {
  describe('constructor', () => {
    it('should initialize registers', () => {
      let operations = SupportedAlgorithms.operations
      let supportedAlgorithms = new SupportedAlgorithms()
      operations.forEach(op => {
        supportedAlgorithms[op].should.eql({})
      })
    })
  })

  describe('static get operations', () => {
    it('should be an array of operations', () => {
      SupportedAlgorithms.operations.should.eql([
        'sign',
        'verify',
        'encrypt',
        'decrypt',
        'importKey'
      ])
    })
  })

  describe('define', () => {
    it('should register an algorithm for an operation', () => {
      let supportedAlgorithms = new SupportedAlgorithms()
      let argument = {}
      supportedAlgorithms.define('RS256', 'verify', argument)
      supportedAlgorithms.verify['RS256'].should.equal(argument)
    })
  })

  describe('normalize', () => {
    it('should return a registered algorithm for an operation by name', () => {
      let supportedAlgorithms = new SupportedAlgorithms()
      let argument = {}
      supportedAlgorithms.define('RS256', 'verify', argument)
      supportedAlgorithms.normalize('verify', 'RS256').should.equal(argument)
    })

    it('should throw NotSupportedError for unknown algorithms', () => {
      let supportedAlgorithms = new SupportedAlgorithms()
      let argument = {}

      expect(() => {
        supportedAlgorithms.normalize('verify', 'RS256').should.equal(argument)
      }).to.throw('RS256 is not a supported algorithm')
    })
  })
})

{'fraction_non_alphanumeric': 0.1553578049684835, 'fraction_numerical': 0.006674082313681869, 'mean_word_length': 3.3168, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 20, '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': '6804556', 'n_tokens_mistral': 758, 'n_tokens_neox': 734, 'n_words': 173}