Sha256: 90498df3599c0945cd9c9b583f6d2b94a7cfc7c3f2de52e512bab5e7ac246782

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

import { InjectedProperty } from 'ember-metal';
import { DEBUG } from '@glimmer/env';
import EmberObject from '../lib/system/object';
import { buildOwner } from 'internal-test-helpers';
import { moduleFor, AbstractTestCase } from 'internal-test-helpers';

moduleFor(
  'inject',
  class extends AbstractTestCase {
    ['@test attempting to inject a nonexistent container key should error']() {
      let owner = buildOwner();
      let AnObject = EmberObject.extend({
        foo: new InjectedProperty('bar', 'baz'),
      });

      owner.register('foo:main', AnObject);

      expectAssertion(() => {
        owner.lookup('foo:main');
      }, /Attempting to inject an unknown injection: 'bar:baz'/);
    }

    ['@test factories should return a list of lazy injection full names'](assert) {
      if (DEBUG) {
        let AnObject = EmberObject.extend({
          foo: new InjectedProperty('foo', 'bar'),
          bar: new InjectedProperty('quux'),
        });

        assert.deepEqual(
          AnObject._lazyInjections(),
          {
            foo: {
              specifier: 'foo:bar',
              source: undefined,
              namespace: undefined,
            },
            bar: {
              specifier: 'quux:bar',
              source: undefined,
              namespace: undefined,
            },
          },
          'should return injected container keys'
        );
      } else {
        assert.expect(0);
      }
    }
  }
);

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/ember-runtime/tests/inject_test.js
discourse-ember-source-3.5.1.0 dist/dist/es/ember-runtime/tests/inject_test.js