<commit_before>import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';

module('NavMenuComponent', function(hooks) {
  setupTest(hooks);

  test('it renders', function(assert) {

    assert.expect(2);

    let startingMenu = {
      title: 'Inventory',
      iconClass: 'octicon-package',
      route: 'inventory',
      capability: 'inventory',
      subnav: [{
        title: 'Requests',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.index',
        capability: 'add_inventory_request'
      }, {
        title: 'Items',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.listing',
        capability: 'inventory'
      }]
    };

    // creates the component instance
    let navMenuProperties = { nav: startingMenu };
    let navMenu = this.owner.factoryFor('component:nav-menu').create(navMenuProperties);
    assert.equal(navMenu._state, 'preRender');

    // appends the navMenu to the page
    this.render();
    assert.equal(navMenu._state, 'inDOM');

  });
});
<commit_msg>Convert nav-menu-test unit test to a render test<commit_after>import { module, test } from 'qunit';
import { setupRenderingTest } from "ember-qunit";
import { render } from "@ember/test-helpers";
import hbs from "htmlbars-inline-precompile";

module('NavMenuComponent', function(hooks) {
  setupRenderingTest(hooks);

  test('it renders', async function(assert) {

    assert.expect(2);

    let startingMenu = {
      title: 'Inventory',
      iconClass: 'octicon-package',
      route: 'inventory',
      capability: 'inventory',
      subnav: [{
        title: 'Requests',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.index',
        capability: 'add_inventory_request',
        localizedTitle: 'First Menu Item'
      }, {
        title: 'Items',
        iconClass: 'octicon-chevron-right',
        route: 'inventory.listing',
        capability: 'inventory',
        localizedTitle: 'Second Menu Item'
      }]
    };

    let currentUserCanStub = () => true;

    this.set('nav', startingMenu);
    this.set("currentUserCanStub", currentUserCanStub);
    await render(hbs`{{nav-menu nav=nav isShowing=true currentUserCan=currentUserCanStub}}`);

    await assert.dom(".category-sub-items div:nth-child(1)").hasText('First Menu Item');
    await assert.dom(".category-sub-items div:nth-child(2)").hasText('Second Menu Item');
  });
});

{'fraction_non_alphanumeric': 0.14409937888198757, 'fraction_numerical': 0.0016563146997929607, 'mean_word_length': 3.179930795847751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '5614418', 'n_tokens_mistral': 741, 'n_tokens_neox': 741, 'n_words': 154}