How to use the @ember/test-helpers.setResolver function in @ember/test-helpers

To help you get started, we’ve selected a few @ember/test-helpers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github emberjs / ember-test-helpers / tests / helpers / resolver.js View on Github external
import { dasherize } from '@ember/string';
import { assign } from '@ember/polyfills';
import { setRegistry } from '../../resolver';
import { setResolver, setApplication } from '@ember/test-helpers';
import require from 'require';
import App from '../../app';
import config from '../../config/environment';

const AppConfig = assign({ autoboot: false }, config.APP);
export const application = App.create(AppConfig);
export const resolver = application.Resolver.create({
  namespace: application,
  isResolverFromTestHelpers: true,
});

setResolver(resolver);
setApplication(application);

export function setResolverRegistry(registry) {
  setRegistry(registry);
}

export default {
  create() {
    return resolver;
  },
};

export function createCustomResolver(registry) {
  if (require.has('ember-native-dom-event-dispatcher')) {
    // the raw value looked up by ember and these test helpers
    registry['event_dispatcher:main'] = require('ember-native-dom-event-dispatcher').default;
github emberjs / data / tests / test-helper.js View on Github external
import RSVP from 'rsvp';
import resolver from './helpers/resolver';
import { setResolver } from '@ember/test-helpers';
import { start } from 'ember-qunit';

import QUnit from 'qunit';
import DS from 'ember-data';
import { wait, asyncEqual, invokeAsync } from 'dummy/tests/helpers/async';

// TODO get us to a setApplication world instead
//   seems to require killing off createStore
setResolver(resolver);

const { assert } = QUnit;
const transforms = {
  boolean: DS.BooleanTransform.create(),
  date: DS.DateTransform.create(),
  number: DS.NumberTransform.create(),
  string: DS.StringTransform.create(),
};

QUnit.begin(() => {
  RSVP.configure('onerror', reason => {
    // only print error messages if they're exceptions;
    // otherwise, let a future turn of the event loop
    // handle the error.
    if (reason && reason instanceof Error) {
      throw reason;
github PoslinskiNet / ember-pell / tests / test-helper.js View on Github external
import resolver from './helpers/resolver';
import { setResolver } from '@ember/test-helpers';
import { start } from 'ember-qunit';

setResolver(resolver);
start();
github rajasegar / ember-aria-checkbox / tests / test-helper.js View on Github external
import resolver from './helpers/resolver';
import {
  setResolver
} from '@ember/test-helpers';
import { start } from 'ember-cli-qunit';

setResolver(resolver);
start();
github danielspaniel / ember-data-change-tracker / tests / test-helper.js View on Github external
import resolver from './helpers/resolver';
import { setResolver } from '@ember/test-helpers';
import { start } from 'ember-cli-qunit';

setResolver(resolver);
start();
github firebase / emberfire / tests / test-helper.js View on Github external
import resolver from './helpers/resolver';
import { setResolver } from '@ember/test-helpers';
import { start } from 'ember-cli-qunit';

setResolver(resolver);
start();
github davidgoli / ember-cli-pull-to-refresh / tests / test-helper.js View on Github external
let aArgs = Array.prototype.slice.call(arguments, 1);
    let fToBind = this;
    let FNOP = function () {};
    let fBound = function () {
      let thisObj = (this instanceof FNOP && oThis) ? this : oThis;
      let args = aArgs.concat(Array.prototype.slice.call(arguments));
      fToBind.apply(thisObj, args);
    };

    FNOP.prototype = this.prototype;
    fBound.prototype = new FNOP();
  };
})();

setResolver(resolver);
start();
github rajasegar / ember-aria-accordion / tests / test-helper.js View on Github external
import resolver from './helpers/resolver';
import {
  setResolver
} from '@ember/test-helpers';

import { start } from 'ember-cli-qunit';

setResolver(resolver);
start();
github ember-cli / ember-exam / tests / test-helper.js View on Github external
import {
  setResolver
} from '@ember/test-helpers';
import resolver from './helpers/resolver';
import start from 'ember-exam/test-support/start';

const oppositeFramework = !require.has('ember-qunit') ? 'qunit' : 'mocha';

Object.keys(require.entries).forEach((entry) => {
  if (entry.indexOf(oppositeFramework) !== -1) {
    delete require.entries[entry];
  }
});

setResolver(resolver);
start();
github imgix / ember-cli-imgix / tests / test-helper.js View on Github external
import resolver from './helpers/resolver';
import { setResolver } from '@ember/test-helpers';
import { start } from 'ember-cli-qunit';

setResolver(resolver);
start();