MAINT: Upgrade to ember 2.16 LTS (#66)
This commit is contained in:
parent
39f4789a61
commit
eb4537afb1
45 changed files with 129 additions and 151 deletions
.travis.ymlREADME.md
app
app.js
package.jsontestem.jsauthenticators
authorizers
components
action-button.jsadmin-section-list.jsccdb-filter.jsccdb-pagination.jsccdb-table.js
collection
crud-form.jsform-content.jsloading-spinner.jsvalidated-field.jscontrollers
index.htmlmixins
models
router.jsroutes
serializers
tests
helpers
unit/authenticators
10
.travis.yml
10
.travis.yml
|
@ -3,11 +3,17 @@ branches:
|
|||
only:
|
||||
- master
|
||||
node_js:
|
||||
- '6'
|
||||
sudo: false
|
||||
- "6"
|
||||
sudo: required
|
||||
dist: trusty
|
||||
addons:
|
||||
chrome: stable
|
||||
cache:
|
||||
directories:
|
||||
- "$HOME/.npm"
|
||||
env:
|
||||
global:
|
||||
- JOBS=1
|
||||
before_install:
|
||||
- npm config set spin false
|
||||
- npm install -g phantomjs-prebuilt
|
||||
|
|
|
@ -10,7 +10,7 @@ You will need the following things properly installed on your computer.
|
|||
* [Git](https://git-scm.com/)
|
||||
* [Node.js](https://nodejs.org/) (with NPM)
|
||||
* [Ember CLI](https://ember-cli.com/)
|
||||
* [PhantomJS](http://phantomjs.org/)
|
||||
* [Google Chrome](https://google.com/chrome/)
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
import Ember from 'ember';
|
||||
import Application from '@ember/application';
|
||||
import Resolver from './resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
|
||||
let App;
|
||||
|
||||
App = Ember.Application.extend({
|
||||
const App = Application.extend({
|
||||
modulePrefix: config.modulePrefix,
|
||||
podModulePrefix: config.podModulePrefix,
|
||||
Resolver
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
import { Promise } from 'rsvp';
|
||||
import $ from 'jquery';
|
||||
import { get } from '@ember/object';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
import { run } from '@ember/runloop';
|
||||
import BaseAuthenticator from 'ember-simple-auth/authenticators/base';
|
||||
import config from '../config/environment';
|
||||
|
||||
const { RSVP: { Promise }, $, get, isEmpty, run } = Ember;
|
||||
|
||||
export default BaseAuthenticator.extend({
|
||||
serverTokenEndpoint: `${config.APP.API_HOST}/api/auth/login/`,
|
||||
tokenAttributeName: 'data.attributes.auth-token',
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
import { get } from '@ember/object';
|
||||
import BaseAuthorizer from 'ember-simple-auth/authorizers/base';
|
||||
|
||||
const { isEmpty, get } = Ember;
|
||||
|
||||
export default BaseAuthorizer.extend({
|
||||
authorize(data, block) {
|
||||
const accessToken = get(data, 'data.attributes.auth-token');
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'a',
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({});
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({ });
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component, computed: { alias }, computed } = Ember;
|
||||
import Component from '@ember/component';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import { computed } from '@ember/object';
|
||||
|
||||
export default Component.extend({
|
||||
// ARGS
|
||||
|
@ -8,7 +8,7 @@ export default Component.extend({
|
|||
|
||||
// COMPUTED
|
||||
meta: alias('model.meta'),
|
||||
links: alias('model.links'),
|
||||
links: alias('meta.links'),
|
||||
|
||||
currentPage: alias('meta.pagination.page'),
|
||||
totalRecords: alias('meta.pagination.count'),
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import Component from '@ember/component';
|
||||
import Table from 'ember-light-table';
|
||||
|
||||
const { Component } = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
// ARGS
|
||||
model: null,
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import Ember from 'ember';
|
||||
import Component from '@ember/component';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Changeset from 'ember-changeset';
|
||||
import lookupValidator from 'ember-changeset-validations';
|
||||
|
||||
const { Component, inject: { service } } = Ember;
|
||||
|
||||
export default Component.extend({
|
||||
store: service(),
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
// ARGS
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
// ARGS
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
// ARGS
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
tagName: 'form',
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component } = Ember;
|
||||
import Component from '@ember/component';
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ['spinner'],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Component, computed, get, isEmpty } = Ember;
|
||||
import Component from '@ember/component';
|
||||
import { get, computed } from '@ember/object';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ['form-group'],
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Controller, inject: { service } } = Ember;
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default Controller.extend({
|
||||
session: service('session'),
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
import Controller from '@ember/controller';
|
||||
import { computed } from '@ember/object';
|
||||
import CollectionValidations from 'ccdb-web/validations/collection';
|
||||
import CollectionSpeciesValidations from 'ccdb-web/validations/collection-species';
|
||||
import CollectionMeasurementValidations from 'ccdb-web/validations/collection-measurement';
|
||||
import DatasheetValidations from 'ccdb-web/validations/datasheet';
|
||||
import ValidationMixin from 'ccdb-web/mixins/validation';
|
||||
|
||||
const { Controller, computed } = Ember;
|
||||
|
||||
export default Controller.extend(ValidationMixin, {
|
||||
CollectionValidations,
|
||||
CollectionSpeciesValidations,
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import Ember from 'ember';
|
||||
import Controller from '@ember/controller';
|
||||
import { computed } from '@ember/object';
|
||||
import CollectionValidations from 'ccdb-web/validations/collection';
|
||||
import CollectionSpeciesValidations from 'ccdb-web/validations/collection-species';
|
||||
import CollectionMeasurementValidations from 'ccdb-web/validations/collection-measurement';
|
||||
import DatasheetValidations from 'ccdb-web/validations/datasheet';
|
||||
import ValidationMixin from 'ccdb-web/mixins/validation';
|
||||
|
||||
const { Controller, computed } = Ember;
|
||||
|
||||
export default Controller.extend(ValidationMixin, {
|
||||
CollectionValidations,
|
||||
CollectionSpeciesValidations,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Controller } = Ember;
|
||||
import Controller from '@ember/controller';
|
||||
|
||||
export default Controller.extend({
|
||||
actions: {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Controller, computed, get, set } = Ember;
|
||||
import Controller from '@ember/controller';
|
||||
import { set, get, computed } from '@ember/object';
|
||||
|
||||
|
||||
export default Controller.extend({
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Controller, inject: { service } } = Ember;
|
||||
import Controller from '@ember/controller';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default Controller.extend({
|
||||
session: service(),
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<body>
|
||||
{{content-for "body"}}
|
||||
|
||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||
<script src="{{rootURL}}assets/ccdb-web.js"></script>
|
||||
<script integrity="" src="{{rootURL}}assets/vendor.js"></script>
|
||||
<script integrity="" src="{{rootURL}}assets/ccdb-web.js"></script>
|
||||
|
||||
{{content-for "body-footer"}}
|
||||
</body>
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Mixin, isArray } = Ember;
|
||||
import Mixin from '@ember/object/mixin';
|
||||
import { isArray } from '@ember/array';
|
||||
const { keys } = Object;
|
||||
|
||||
// Portions borrowed from https://github.com/funtusov/ember-cli-form-data
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Mixin, get, RSVP } = Ember;
|
||||
import Mixin from '@ember/object/mixin';
|
||||
import { get } from '@ember/object';
|
||||
import RSVP from 'rsvp';
|
||||
const { keys } = Object;
|
||||
const { isArray } = Array;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import { mapBy } from '@ember/object/computed';
|
||||
import { computed } from '@ember/object';
|
||||
import DS from 'ember-data';
|
||||
|
||||
const { computed } = Ember;
|
||||
const { Model, attr, belongsTo, hasMany } = DS;
|
||||
|
||||
export default Model.extend({
|
||||
|
@ -24,11 +24,11 @@ export default Model.extend({
|
|||
envMeasurements: hasMany('collection-measurement'),
|
||||
|
||||
// computed
|
||||
species: computed.mapBy('collectionSpecies', 'species'),
|
||||
species: mapBy('collectionSpecies', 'species'),
|
||||
|
||||
speciesNames: computed.mapBy('species', 'commonName'),
|
||||
speciesNames: mapBy('species', 'commonName'),
|
||||
|
||||
counts: computed.mapBy('collectionSpecies', 'count'),
|
||||
counts: mapBy('collectionSpecies', 'count'),
|
||||
|
||||
speciesAndCounts: computed('speciesNames', 'counts', function() {
|
||||
const speciesNames = this.get('speciesNames');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import Ember from 'ember';
|
||||
import EmberRouter from '@ember/routing/router';
|
||||
import config from './config/environment';
|
||||
|
||||
const Router = Ember.Router.extend({
|
||||
const Router = EmberRouter.extend({
|
||||
location: config.locationType,
|
||||
rootURL: config.rootURL
|
||||
});
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
import Route from '@ember/routing/route';
|
||||
import ApplicationRouteMixin from 'ember-simple-auth/mixins/application-route-mixin';
|
||||
|
||||
const { Route } = Ember;
|
||||
|
||||
export default Route.extend(ApplicationRouteMixin, {});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Route, RSVP } = Ember;
|
||||
import Route from '@ember/routing/route';
|
||||
import RSVP from 'rsvp';
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Route, RSVP } = Ember;
|
||||
import Route from '@ember/routing/route';
|
||||
import RSVP from 'rsvp';
|
||||
|
||||
export default Route.extend({
|
||||
model(params) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Route, RSVP } = Ember;
|
||||
import Route from '@ember/routing/route';
|
||||
import RSVP from 'rsvp';
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Route, RSVP } = Ember;
|
||||
import Route from '@ember/routing/route';
|
||||
import RSVP from 'rsvp';
|
||||
|
||||
export default Route.extend({
|
||||
queryParams: {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
import Ember from 'ember';
|
||||
import Route from '@ember/routing/route';
|
||||
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
|
||||
|
||||
const { Route } = Ember;
|
||||
|
||||
export default Route.extend(AuthenticatedRouteMixin, {
|
||||
afterModel() {
|
||||
this.transitionTo('collections');
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
import Ember from 'ember';
|
||||
import Route from '@ember/routing/route';
|
||||
import UnauthenticatedRouteMixin from 'ember-simple-auth/mixins/unauthenticated-route-mixin';
|
||||
|
||||
const { Route } = Ember;
|
||||
|
||||
export default Route.extend(UnauthenticatedRouteMixin, {});
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
|
||||
const { Route, inject: { service }} = Ember;
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
||||
export default Route.extend({
|
||||
session: service('session'),
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
import Ember from 'ember';
|
||||
import { capitalize } from '@ember/string';
|
||||
import DS from 'ember-data';
|
||||
|
||||
const { JSONAPISerializer } = DS;
|
||||
|
||||
export default JSONAPISerializer.extend({
|
||||
payloadTypeFromModelName(modelName) {
|
||||
return modelName.split('-').map(key => Ember.String.capitalize(key)).join('');
|
||||
}
|
||||
return modelName.split('-').map(key => capitalize(key)).join('');
|
||||
},
|
||||
|
||||
normalizeArrayResponse(store, primaryModelClass, payload, id, requestType) {
|
||||
let normalizedDocument = this._super(store, primaryModelClass, payload, id, requestType);
|
||||
normalizedDocument.meta.links = normalizedDocument.links;
|
||||
return normalizedDocument;
|
||||
},
|
||||
});
|
||||
|
|
18
package.json
18
package.json
|
@ -19,23 +19,23 @@
|
|||
"ember-ajax": "^3.0.0",
|
||||
"ember-changeset": "1.3.0",
|
||||
"ember-changeset-validations": "1.2.8",
|
||||
"ember-cli": "~2.14.0",
|
||||
"ember-cli": "^2.16.2",
|
||||
"ember-cli-app-version": "^3.0.0",
|
||||
"ember-cli-babel": "^6.3.0",
|
||||
"ember-cli-babel": "^6.6.0",
|
||||
"ember-cli-code-coverage": "^0.4.1",
|
||||
"ember-cli-dependency-checker": "^1.3.0",
|
||||
"ember-cli-eslint": "^3.0.0",
|
||||
"ember-cli-flash": "1.4.3",
|
||||
"ember-cli-dependency-checker": "^2.0.0",
|
||||
"ember-cli-eslint": "^4.0.0",
|
||||
"ember-cli-flash": "^1.4.3",
|
||||
"ember-cli-htmlbars": "^2.0.1",
|
||||
"ember-cli-htmlbars-inline-precompile": "^0.4.3",
|
||||
"ember-cli-htmlbars-inline-precompile": "^1.0.0",
|
||||
"ember-cli-inject-live-reload": "^1.4.1",
|
||||
"ember-cli-moment-shim": "^3.5.0",
|
||||
"ember-cli-qunit": "^4.0.0",
|
||||
"ember-cli-shims": "^1.1.0",
|
||||
"ember-cli-sri": "^2.1.0",
|
||||
"ember-cli-uglify": "^1.2.0",
|
||||
"ember-cli-uglify": "^2.0.0",
|
||||
"ember-composable-helpers": "^2.0.3",
|
||||
"ember-data": "~2.14.3",
|
||||
"ember-data": "~2.16.2",
|
||||
"ember-export-application-global": "^2.0.0",
|
||||
"ember-inflector": "^2.0.1",
|
||||
"ember-light-table": "^1.10.0",
|
||||
|
@ -48,7 +48,7 @@
|
|||
"ember-responsive": "^2.0.4",
|
||||
"ember-simple-auth": "1.4.0",
|
||||
"ember-sinon": "^1.0.0",
|
||||
"ember-source": "~2.14.0",
|
||||
"ember-source": "~2.16.0",
|
||||
"loader.js": "^4.2.3"
|
||||
},
|
||||
"engines": {
|
||||
|
|
16
testem.js
16
testem.js
|
@ -3,10 +3,20 @@ module.exports = {
|
|||
test_page: 'tests/index.html?hidepassed',
|
||||
disable_watching: true,
|
||||
launch_in_ci: [
|
||||
'PhantomJS'
|
||||
'Chrome'
|
||||
],
|
||||
launch_in_dev: [
|
||||
'PhantomJS',
|
||||
'Chrome'
|
||||
]
|
||||
],
|
||||
browser_args: {
|
||||
Chrome: {
|
||||
mode: 'ci',
|
||||
args: [
|
||||
'--disable-gpu',
|
||||
'--headless',
|
||||
'--remote-debugging-port=9222',
|
||||
'--window-size=1440,900'
|
||||
]
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import Ember from 'ember';
|
||||
import { run } from '@ember/runloop';
|
||||
|
||||
export default function destroyApp(application) {
|
||||
Ember.run(application, 'destroy');
|
||||
run(application, 'destroy');
|
||||
}
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import Ember from 'ember';
|
||||
import FlashObject from 'ember-cli-flash/flash/object';
|
||||
|
||||
const { K } = Ember;
|
||||
|
||||
FlashObject.reopen({ init: K });
|
||||
FlashObject.reopen({ init() {} });
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { module } from 'qunit';
|
||||
import Ember from 'ember';
|
||||
import { resolve } from 'rsvp';
|
||||
import startApp from '../helpers/start-app';
|
||||
import destroyApp from '../helpers/destroy-app';
|
||||
|
||||
const { RSVP: { resolve } } = Ember;
|
||||
|
||||
export default function(name, options = {}) {
|
||||
module(name, {
|
||||
beforeEach() {
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
import Ember from 'ember';
|
||||
import { registerAsyncHelper } from '@ember/test';
|
||||
import { A } from '@ember/array';
|
||||
import { computed } from '@ember/object';
|
||||
import { classify } from '@ember/string';
|
||||
import { getOwner } from '@ember/application';
|
||||
import MediaService from 'ember-responsive/media';
|
||||
|
||||
const {
|
||||
getOwner
|
||||
} = Ember;
|
||||
const { classify } = Ember.String;
|
||||
|
||||
MediaService.reopen({
|
||||
// Change this if you want a different default breakpoint in tests.
|
||||
_defaultBreakpoint: 'desktop',
|
||||
|
||||
_breakpointArr: Ember.computed('breakpoints', function() {
|
||||
return Object.keys(this.get('breakpoints')) || Ember.A([]);
|
||||
_breakpointArr: computed('breakpoints', function() {
|
||||
return Object.keys(this.get('breakpoints')) || A([]);
|
||||
}),
|
||||
|
||||
_forceSetBreakpoint(breakpoint) {
|
||||
|
@ -45,7 +44,7 @@ MediaService.reopen({
|
|||
}
|
||||
});
|
||||
|
||||
export default Ember.Test.registerAsyncHelper('setBreakpoint', function(app, breakpoint) {
|
||||
export default registerAsyncHelper('setBreakpoint', function(app, breakpoint) {
|
||||
// this should use getOwner once that's supported
|
||||
const mediaService = app.__deprecatedInstance__.lookup('service:media');
|
||||
mediaService._forceSetBreakpoint(breakpoint);
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
import Ember from 'ember';
|
||||
import Application from '../../app';
|
||||
import config from '../../config/environment';
|
||||
import { merge } from '@ember/polyfills';
|
||||
import { run } from '@ember/runloop';
|
||||
|
||||
export default function startApp(attrs) {
|
||||
let attributes = Ember.merge({}, config.APP);
|
||||
attributes = Ember.merge(attributes, attrs); // use defaults, but you can override;
|
||||
let attributes = merge({}, config.APP);
|
||||
attributes = merge(attributes, attrs); // use defaults, but you can override;
|
||||
|
||||
return Ember.run(() => {
|
||||
return run(() => {
|
||||
let application = Application.create(attributes);
|
||||
application.setupForTesting();
|
||||
application.injectTestHelpers();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import $ from 'jquery';
|
||||
import { moduleFor, test } from 'ember-qunit';
|
||||
import sinon from 'sinon';
|
||||
import Ember from 'ember';
|
||||
|
||||
moduleFor('authenticator:application', 'Unit | application', {
|
||||
unit: true,
|
||||
|
@ -35,28 +35,28 @@ test('`invalidate` should invalidate the session', function(assert) {
|
|||
|
||||
test('`makeRequest` should make a request', function(assert) {
|
||||
assert.expect(2);
|
||||
const stub = sinon.stub(Ember.$, 'ajax');
|
||||
const stub = sinon.stub($, 'ajax');
|
||||
stub.resolves(42);
|
||||
const authenticator = this.subject();
|
||||
authenticator.set('serverTokenEndpoint', 'foo')
|
||||
const promise = authenticator.makeRequest({bar: 'baz'}).then((d) => {
|
||||
assert.equal(d, 42);
|
||||
});
|
||||
assert.ok(Ember.$.ajax.calledWithMatch({url: 'foo', data: {bar: 'baz'}}));
|
||||
Ember.$.ajax.restore();
|
||||
assert.ok($.ajax.calledWithMatch({url: 'foo', data: {bar: 'baz'}}));
|
||||
$.ajax.restore();
|
||||
return promise;
|
||||
});
|
||||
|
||||
test('authenticate should craft a nice payload', function(assert) {
|
||||
assert.expect(2);
|
||||
const stub = sinon.stub(Ember.$, 'ajax');
|
||||
const stub = sinon.stub($, 'ajax');
|
||||
stub.resolves(42);
|
||||
const authenticator = this.subject();
|
||||
authenticator.set('serverTokenEndpoint', 'foo')
|
||||
const promise = authenticator.authenticate('myusername', 'mypassword').then((d) => {
|
||||
assert.equal(d, 42);
|
||||
});
|
||||
assert.ok(Ember.$.ajax.calledWithMatch({url: 'foo', data: {username: 'myusername', password: 'mypassword'}}));
|
||||
Ember.$.ajax.restore();
|
||||
assert.ok($.ajax.calledWithMatch({url: 'foo', data: {username: 'myusername', password: 'mypassword'}}));
|
||||
$.ajax.restore();
|
||||
return promise;
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue