mardi 4 août 2020

Error: "No model was found for 'application' and no schema handles the type" when trying to test ember component

This is my component

<section>
    <h2></h2>
    <p></p>
    
</section>

This is my integration test.

import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';

module('Integration | Component | section', function(hooks) {
  setupRenderingTest(hooks);

  test('it renders', async function(assert) {
    // Set any properties with this.set('myProperty', 'value');
    // Handle any actions with this.set('myAction', function(val) { ... });

    let section = {
      title: 'Fractions',
      slug: 'fractions',
      body: 'Learn new option of responsiveness. Instead of columns, we use fractions.'
    }

    this.set('model', section);

    await render(hbs`<Section @section= />`);

    assert.equal(this.element.querySelector('h2').textContent.trim(), section.title);
  });
});

I got this error when I execute the test: No model was found for 'application' and no schema handles the type" when trying to test ember component I did not found how to fix it until now.




Aucun commentaire:

Enregistrer un commentaire