Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { moduleFor, test } from 'ember-qunit';
moduleFor('route:fd-listform-constructor', 'Unit | Route | fd-listform-constructor', {
// Specify the other units that are required for this test.
// needs: ['controller:foo']
});
test('it exists', function(assert) {
let route = this.subject();
assert.ok(route);
});
import Ember from 'ember';
import AnalyticsMixin from 'ember-osf/mixins/analytics';
import { moduleFor, test } from 'ember-qunit';
const { getOwner } = Ember;
const service = Ember.Service.extend({
props: null,
trackEvent(...args) {
this.set('props', [...args]);
}
});
moduleFor('mixin:analytics', {
subject(){
this.register('service:metrics', service);
this.inject.service('metrics');
const analyticsObject = Ember.Controller.extend(AnalyticsMixin);
this.registry.register('test:subject', analyticsObject);
return getOwner(this).lookup('test:subject');
}
});
test("Google Analytics mixin", function(assert) {
const subject = this.subject();
assert.ok(AnalyticsMixin.detect(subject));
Ember.run(() => {
subject.send('click', 'test category', 'test label');
import Ember from 'ember';
import AnalyticsMixin from 'ember-osf-web/mixins/analytics';
import { moduleFor, test } from 'ember-qunit';
const { getOwner } = Ember;
const service = Ember.Service.extend({
props: null,
trackEvent(...args) {
this.set('props', [...args]);
},
});
moduleFor('mixin:analytics', {
subject() {
this.register('service:metrics', service);
this.inject.service('metrics');
const analyticsObject = Ember.Controller.extend(AnalyticsMixin);
this.registry.register('test:subject', analyticsObject);
return getOwner(this).lookup('test:subject');
},
});
test('Google Analytics mixin', function(assert) {
const subject = this.subject();
assert.ok(AnalyticsMixin.detect(subject));
Ember.run(() => {
subject.send('click', 'test category', 'test label');
assert.ok(subject.get('metrics.props'));
export default function(what, name, needs = [], testCase = null) {
const defaultNeeds = ['service:metrics', 'ember-metrics@metrics-adapter:google-analytics', 'service:session', 'service:notify', 'service:router-scroll'];
moduleFor(what, name, {
needs: defaultNeeds.concat(needs)
});
if (testCase) {
test('it exists', testCase);
}
}
import {
test,
moduleFor
} from 'ember-qunit';
import Ember from "ember";
import { stubRequest } from 'ember-cli-fake-server';
import modelDeps from '../../support/common-model-dependencies';
var store;
moduleFor('adapter:app', 'AppAdapter', {
needs: modelDeps.concat([
'store:application',
'serializer:application'
]),
setup: function(){
store = this.container.lookup('store:application');
}
});
test('findQuery uses correct URL', function(assert) {
var done = assert.async();
assert.expect(1);
stubRequest('get', '/accounts/my-stack-1/databases', function() {
assert.ok(true, 'uses correct URL');
done();
import { test, skip, moduleFor, moduleForModel, moduleForComponent, setResolver } from 'ember-qunit';
moduleForComponent('x-foo', {
integration: true
});
moduleForComponent('x-foo', {
unit: true,
needs: ['helper:pluralize-string']
});
moduleForModel('user', {
needs: ['model:child']
});
moduleFor('controller:home');
moduleFor('component:x-foo', 'Some description');
moduleFor('component:x-foo', 'TestModule callbacks', {
beforeSetup() {
},
beforeEach(assert) {
this.registry.register('helper:i18n', {});
this.register('service:i18n', {});
this.inject.service('i18n');
this.inject.service('i18n', { as: 'i18n' });
this.factory('object:user').create();
assert.ok(true);
},
export default function moduleForSlEmberModel(name, description, callbacks) {
moduleFor('model:' + name, description, callbacks, function(container, context, defaultSubject) {
container.register('store:main', SlEmberModelStore );
context.__setup_properties__.store = function(){
return container.lookup('store:main');
};
if (context.__setup_properties__.subject === defaultSubject) {
context.__setup_properties__.subject = function(options) {
return Ember.run(function() {
return container.lookup('store:main').createRecord(name, options);
});
};
}
});
}
import Ember from 'ember';
import { moduleFor, test } from 'ember-qunit';
import { translationMacro as t } from 'ember-intl';
moduleFor('service:intl', 'Unit | Macrol', {
integration: true,
beforeEach() {
const intl = this.subject();
intl.setLocale('en');
this.object = Ember.Object
.extend({
intl: intl,
numberClicks: 9,
tMacroProperty1: t('no.interpolations'),
tMacroProperty2: t('with.interpolations', { clicks: 'numberClicks' })
})
.create();
}
});
moduleForComponent('x-foo', {
integration: true
});
moduleForComponent('x-foo', {
unit: true,
needs: ['helper:pluralize-string']
});
moduleForModel('user', {
needs: ['model:child']
});
moduleFor('controller:home');
moduleFor('component:x-foo', 'Some description');
moduleFor('component:x-foo', 'TestModule callbacks', {
beforeSetup() {
},
beforeEach(assert) {
this.registry.register('helper:i18n', {});
this.register('service:i18n', {});
this.inject.service('i18n');
this.inject.service('i18n', { as: 'i18n' });
this.factory('object:user').create();
assert.ok(true);
},
afterEach(assert) {
assert.ok(true);
});
moduleForComponent('x-foo', {
unit: true,
needs: ['helper:pluralize-string']
});
moduleForModel('user', {
needs: ['model:child']
});
moduleFor('controller:home');
moduleFor('component:x-foo', 'Some description');
moduleFor('component:x-foo', 'TestModule callbacks', {
beforeSetup() {
},
beforeEach(assert) {
this.registry.register('helper:i18n', {});
this.register('service:i18n', {});
this.inject.service('i18n');
this.inject.service('i18n', { as: 'i18n' });
this.factory('object:user').create();
assert.ok(true);
},
afterEach(assert) {
assert.ok(true);
},