refactor: 💡 upgrade addons/api to Ember 3.24
This commit is contained in:
92 files changed
+1348
-621
No files matched your search
@@ -9,7 +9,7 @@ module('Unit | Mixin | build-url', function (hooks) {
|
||||
|
||||
test('it does not interfere with basic URLs', function (assert) {
|
||||
assert.expect(1);
|
||||
/* eslint-disable-next-line ember/no-new-mixins */
|
||||
/* eslint-disable-next-line ember/no-new-mixins, ember/no-classic-classes */
|
||||
const Adapter = RESTAdapter.extend(AdapterBuildURLMixin);
|
||||
this.owner.register('adapter:adapter', Adapter);
|
||||
const adapter = this.owner.lookup('adapter:adapter');
|
||||
@@ -19,7 +19,7 @@ module('Unit | Mixin | build-url', function (hooks) {
|
||||
|
||||
test('it does not interfere with namespaced URLs', function (assert) {
|
||||
assert.expect(1);
|
||||
/* eslint-disable-next-line ember/no-new-mixins */
|
||||
/* eslint-disable-next-line ember/no-new-mixins, ember/no-classic-classes */
|
||||
const Adapter = RESTAdapter.extend(AdapterBuildURLMixin, {
|
||||
namespace: 'api/v1',
|
||||
});
|
||||
@@ -31,7 +31,7 @@ module('Unit | Mixin | build-url', function (hooks) {
|
||||
|
||||
test('it can prepend a prefix', function (assert) {
|
||||
assert.expect(1);
|
||||
/* eslint-disable-next-line ember/no-new-mixins */
|
||||
/* eslint-disable-next-line ember/no-new-mixins, ember/no-classic-classes */
|
||||
const Adapter = RESTAdapter.extend(AdapterBuildURLMixin, {
|
||||
urlPrefix() {
|
||||
return '/foo/bars';
|
||||
@@ -45,7 +45,7 @@ module('Unit | Mixin | build-url', function (hooks) {
|
||||
|
||||
test('it can append a suffix', function (assert) {
|
||||
assert.expect(1);
|
||||
/* eslint-disable-next-line ember/no-new-mixins */
|
||||
/* eslint-disable-next-line ember/no-new-mixins, ember/no-classic-classes */
|
||||
const Adapter = RESTAdapter.extend(AdapterBuildURLMixin, {
|
||||
urlSuffix() {
|
||||
return ':method';
|
||||
|
||||
@@ -21,5 +21,4 @@ module('Unit | Model | account', function (hooks) {
|
||||
model.attributes.login_name = 'username';
|
||||
assert.equal(model.username, 'username');
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | auth token', function(hooks) {
|
||||
module('Unit | Model | auth token', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('auth-token', {});
|
||||
assert.ok(model);
|
||||
|
||||
@@ -24,10 +24,7 @@ module('Unit | Model | host set', function (hooks) {
|
||||
attributes: {
|
||||
name: 'Host Set',
|
||||
description: 'Description',
|
||||
host_ids: [
|
||||
{value: '1'},
|
||||
{value: '3'},
|
||||
],
|
||||
host_ids: [{ value: '1' }, { value: '3' }],
|
||||
version: 1,
|
||||
scope: {
|
||||
scope_id: 'o_1',
|
||||
@@ -58,10 +55,7 @@ module('Unit | Model | host set', function (hooks) {
|
||||
attributes: {
|
||||
name: 'Host Set',
|
||||
description: 'Description',
|
||||
host_ids: [
|
||||
{value: '1'},
|
||||
{value: '3'},
|
||||
],
|
||||
host_ids: [{ value: '1' }, { value: '3' }],
|
||||
version: 1,
|
||||
scope: {
|
||||
scope_id: 'o_1',
|
||||
@@ -92,10 +86,7 @@ module('Unit | Model | host set', function (hooks) {
|
||||
attributes: {
|
||||
name: 'Host Set',
|
||||
description: 'Description',
|
||||
host_ids: [
|
||||
{value: '1'},
|
||||
{value: '3'},
|
||||
],
|
||||
host_ids: [{ value: '1' }, { value: '3' }],
|
||||
version: 1,
|
||||
scope: {
|
||||
scope_id: 'o_1',
|
||||
@@ -126,10 +117,7 @@ module('Unit | Model | host set', function (hooks) {
|
||||
attributes: {
|
||||
name: 'Host Set',
|
||||
description: 'Description',
|
||||
host_ids: [
|
||||
{value: '1'},
|
||||
{value: '3'},
|
||||
],
|
||||
host_ids: [{ value: '1' }, { value: '3' }],
|
||||
version: 1,
|
||||
scope: {
|
||||
scope_id: 'o_1',
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Model | session', function(hooks) {
|
||||
module('Unit | Model | session', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('session', {});
|
||||
assert.ok(model);
|
||||
assert.notOk(model.isCancelable);
|
||||
});
|
||||
|
||||
test('it allows cancellation of an active session', function(assert) {
|
||||
test('it allows cancellation of an active session', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('session', {
|
||||
status: 'active'
|
||||
status: 'active',
|
||||
});
|
||||
assert.ok(model.isCancelable);
|
||||
});
|
||||
|
||||
test('it allows cancellation of a pending session', function(assert) {
|
||||
test('it allows cancellation of a pending session', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('session', {
|
||||
status: 'pending'
|
||||
status: 'pending',
|
||||
});
|
||||
assert.ok(model.isCancelable);
|
||||
});
|
||||
@@ -31,7 +31,7 @@ module('Unit | Model | session', function(hooks) {
|
||||
assert.expect(2);
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('session', {
|
||||
status: 'pending'
|
||||
status: 'pending',
|
||||
});
|
||||
assert.notOk(model.isActive);
|
||||
model.status = 'active';
|
||||
@@ -42,7 +42,7 @@ module('Unit | Model | session', function(hooks) {
|
||||
assert.expect(2);
|
||||
let store = this.owner.lookup('service:store');
|
||||
let model = store.createRecord('session', {
|
||||
status: 'active'
|
||||
status: 'active',
|
||||
});
|
||||
assert.notOk(model.isPending);
|
||||
model.status = 'pending';
|
||||
@@ -55,7 +55,7 @@ module('Unit | Model | session', function(hooks) {
|
||||
assert.equal(model.proxy, null);
|
||||
model.setProperties({
|
||||
proxy_address: 'localhost',
|
||||
proxy_port: '12345'
|
||||
proxy_port: '12345',
|
||||
});
|
||||
assert.equal(model.proxy, 'localhost:12345');
|
||||
});
|
||||
|
||||
@@ -186,33 +186,37 @@ module('Unit | Model | target', function (hooks) {
|
||||
store.push({
|
||||
data: {
|
||||
id: '123abc',
|
||||
type: 'target'
|
||||
}
|
||||
type: 'target',
|
||||
},
|
||||
});
|
||||
const target = store.peekRecord('target', '123abc');
|
||||
assert.equal( target.sessions.length, 0);
|
||||
assert.equal(target.sessions.length, 0);
|
||||
store.push({
|
||||
data: {
|
||||
id: '1',
|
||||
type: 'session',
|
||||
attributes: { target_id: '123abc' }
|
||||
}
|
||||
attributes: { target_id: '123abc' },
|
||||
},
|
||||
});
|
||||
store.push({
|
||||
data: {
|
||||
id: '2',
|
||||
type: 'session',
|
||||
attributes: { target_id: '123abc' }
|
||||
}
|
||||
attributes: { target_id: '123abc' },
|
||||
},
|
||||
});
|
||||
store.push({
|
||||
data: {
|
||||
id: '3',
|
||||
type: 'session',
|
||||
attributes: { target_id: '456xyz' }
|
||||
}
|
||||
attributes: { target_id: '456xyz' },
|
||||
},
|
||||
});
|
||||
assert.equal(store.peekAll('session').length, 3, 'There are 3 sessions loaded in the store');
|
||||
assert.equal(
|
||||
store.peekAll('session').length,
|
||||
3,
|
||||
'There are 3 sessions loaded in the store'
|
||||
);
|
||||
assert.equal(
|
||||
target.sessions.length,
|
||||
2,
|
||||
|
||||
@@ -66,7 +66,7 @@ module('Unit | Serializer | application', function (hooks) {
|
||||
const serializedRecord = serializer.serialize(snapshot);
|
||||
assert.deepEqual(serializedRecord, {
|
||||
name: 'User',
|
||||
description: 'Description'
|
||||
description: 'Description',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -172,7 +172,7 @@ module('Unit | Serializer | application', function (hooks) {
|
||||
attributes: {
|
||||
name: 'User 1',
|
||||
account_ids: [],
|
||||
scope: { scope_id: 'o_123' }
|
||||
scope: { scope_id: 'o_123' },
|
||||
},
|
||||
relationships: {},
|
||||
},
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | host', function(hooks) {
|
||||
module('Unit | Serializer | host', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('host');
|
||||
|
||||
assert.ok(serializer);
|
||||
});
|
||||
|
||||
test('it serializes records', function(assert) {
|
||||
test('it serializes records', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let record = store.createRecord('host', {});
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ module('Unit | Serializer | role', function (hooks) {
|
||||
name: 'User',
|
||||
description: 'Description',
|
||||
version: 1,
|
||||
grant_scope_id: null
|
||||
grant_scope_id: null,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
module('Unit | Serializer | session', function(hooks) {
|
||||
module('Unit | Serializer | session', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
test('it exists', function (assert) {
|
||||
let store = this.owner.lookup('service:store');
|
||||
let serializer = store.serializerFor('session');
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
type: 'org',
|
||||
},
|
||||
version: 1,
|
||||
type: 'tcp'
|
||||
type: 'tcp',
|
||||
});
|
||||
const snapshot = record._createSnapshot();
|
||||
snapshot.adapterOptions = {};
|
||||
|
||||
@@ -55,11 +55,7 @@ module('Unit | Serializer | user', function (hooks) {
|
||||
name: 'user 1',
|
||||
scope: { id: 'o_123' },
|
||||
};
|
||||
const normalized = serializer.normalizeSingleResponse(
|
||||
store,
|
||||
user,
|
||||
payload
|
||||
);
|
||||
const normalized = serializer.normalizeSingleResponse(store, user, payload);
|
||||
assert.deepEqual(normalized, {
|
||||
included: [],
|
||||
data: {
|
||||
|
||||
Reference in new issue
Block a user