<commit_before>import DOMRouter from 'core/DOMRouter';


describe('DOMRouter', () => {
  test('can run a specific action of a specific controller', () => {
    let testController = { init: jest.fn(), };
    let controllers = { test: testController, };
    let router = new DOMRouter(controllers);
    router.execAction('test', 'init');
    expect(testController.init).toHaveBeenCalled();
  });
});<commit_msg>Updated JS tests<commit_after>import DOMRouter from 'core/DOMRouter';


describe('DOMRouter', () => {
  test('can run a specific action of a specific controller', () => {
    let testController = { init: jest.fn(), };
    let controllers = { test: testController, };
    let router = new DOMRouter(controllers);
    router.execAction('test', 'init');
    expect(testController.init).toHaveBeenCalled();
  });

  test('can trigger the right controller using data attributes on the <body> tag', () => {
    let testController01 = { init: jest.fn(), doSomething: jest.fn(), doSomethingElse: jest.fn(), };
    let testController02 = { init: jest.fn(), doSomethingElseAgain: jest.fn(), };
    let controllers = { test01: testController01, test02: testController02, };
    let router = new DOMRouter(controllers);
    // Set up our document body
    document.body.setAttribute('data-controller', 'test01');
    document.body.setAttribute('data-action', 'doSomething');
    router.init();
    expect(testController01.init).toHaveBeenCalled();
    expect(testController01.doSomething).toHaveBeenCalled();
    expect(testController01.doSomethingElse).not.toHaveBeenCalled();
    expect(testController02.init).not.toHaveBeenCalled();
    expect(testController02.doSomethingElseAgain).not.toHaveBeenCalled();
  });
});
{'fraction_non_alphanumeric': 0.14976689976689977, 'fraction_numerical': 0.013986013986013986, 'mean_word_length': 4.704318936877076, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, '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': '5509197', 'n_tokens_mistral': 502, 'n_tokens_neox': 484, 'n_words': 111}