<commit_before>const VirtualAudioGraph = require('../../dist/index.js');

describe('virtualAudioGraph.update - error throwing conditions', function () {
  var audioContext;
  var virtualAudioGraph;

  beforeEach(function () {
    audioContext = new AudioContext();
    virtualAudioGraph = new VirtualAudioGraph({
      audioContext: audioContext,
      output: audioContext.destination,
    });
  });

  it('throws an error if no id is provided', function () {
    const virtualNodeParams = [{
      node: 'gain',
      output: 'output',
    }];
    expect(function () {
      virtualAudioGraph.update(virtualNodeParams);
    }).toThrow();
  });

  it('throws an error if no output is provided', function () {
    const virtualNodeParams = [{
      node: 'gain',
      id: 1,
    }];
    expect(function () {
      virtualAudioGraph.update(virtualNodeParams);
    }).toThrow();
  });

  it('throws an error when virtual node name property is not recognised', function () {
    const virtualNodeParams = [{
      id: 0,
      node: 'foobar',
      output: 'output',
    }];
    expect(function () {
      virtualAudioGraph.update(virtualNodeParams);
    }).toThrow();
  });
});<commit_msg>add new spec - throw error if id is 'output'<commit_after>const VirtualAudioGraph = require('../../dist/index.js');

describe('virtualAudioGraph.update - error throwing conditions', function () {
  var audioContext;
  var virtualAudioGraph;

  beforeEach(function () {
    audioContext = new AudioContext();
    virtualAudioGraph = new VirtualAudioGraph({
      audioContext: audioContext,
      output: audioContext.destination,
    });
  });

  it('throws an error if no id is provided', function () {
    expect(function () {
      virtualAudioGraph.update([{
        node: 'gain',
        output: 'output',
      }]);
    }).toThrow();
  });

  it('throws an error if no output is provided', function () {
    expect(function () {
      virtualAudioGraph.update([{
        node: 'gain',
        id: 1,
      }]);
    }).toThrow();
  });

  it('throws an error when virtual node name property is not recognised', function () {
    expect(function () {
      virtualAudioGraph.update([{
        id: 0,
        node: 'foobar',
        output: 'output',
      }]);
    }).toThrow();
  });

  it('throws an error when id is "output"', function () {
    expect(function () {
      virtualAudioGraph.update([{
        id: 'output',
        node: 'gain',
        output: 'output',
      }]);
    }).toThrow();
  });
});
{'fraction_non_alphanumeric': 0.1490211745904914, 'fraction_numerical': 0.0015980823012385138, 'mean_word_length': 2.7881996974281393, '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': '5804296', 'n_tokens_mistral': 711, 'n_tokens_neox': 693, 'n_words': 183}