Skip to content

Trouble testing component that uses the helper with a custom config #5

@mjuniper

Description

@mjuniper

I have a component that uses the helper with a custom config. It works perfectly in the app but now I am trying to write an integration test for it.

My first stab got me this: Failed to create an instance of 'sanitizer:links-only'. Most likely an improperly defined class or an invalid module export.

So I figured I need to run the initializer. My test now looks something like this:

import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
import initializer from 'my-app/initializers/setup-sanitizers';

moduleForComponent('my-component', 'Integration | Component | my component', {
  integration: true,

  setup() {
    // manually invoke the ember-sanitize initializer
    initializer.initialize(this);
    //initializer.initialize(this.container);
  }
});

test('it renders', function(assert) {
  ...
});

But now I get container.registerOptionsForType is not a function coming out of the initializer. I think I'm on the right track but I'm not sure what to pass to the initializer. Any suggestions? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions