Skip to content

Add referrer capability to the test resolver#16239

Merged
mixonic merged 1 commit intoemberjs:masterfrom
mixonic:improve-resolver-tests
Feb 13, 2018
Merged

Add referrer capability to the test resolver#16239
mixonic merged 1 commit intoemberjs:masterfrom
mixonic:improve-resolver-tests

Conversation

@mixonic
Copy link
Member

@mixonic mixonic commented Feb 13, 2018

Extracted from #16158

This patch improves the the test-mode resolver used across the suite. It allows the addition of a resolution with a referrer. For example:

  moduleFor('Registry module unification', class extends AbstractTestCase {
    ['@test The registry can pass a referrer to the resolver'](assert) {
      let PrivateComponent = factory();
      let type = 'component';
      let name = 'my-input';
      let specifier = `${type}:${name}`;
      let referrer = 'template:routes/application';

      let resolver = new ModuleBasedTestResolver();
      resolver.add({specifier, referrer}, PrivateComponent); // <- added with the fullName, and an expected referrer
      let registry = new Registry({ resolver });

      assert.strictEqual(
        registry.resolve(specifier, { referrer }),
        PrivateComponent,
        'The correct factory was provided'
      );
      assert.strictEqual(
        registry.resolve(specifier, { referrer }),
        PrivateComponent,
        'The correct factory was provided again'
      );
    }
  });

@mixonic mixonic merged commit 3588959 into emberjs:master Feb 13, 2018
@mixonic mixonic deleted the improve-resolver-tests branch February 13, 2018 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant