refactor: 💡 Remove usage of indexed DB (#2979)
* refactor: 💡 Remove usage of indexed DB
This commit is contained in:
1 parent
4c7ea161cd
commit
9e263379a7
101 files changed
+15
-2682
No files matched your search
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
/**
|
||||
* This test helper can help set up and cleanup the database in your tests.
|
||||
*
|
||||
* ```js
|
||||
* import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
*
|
||||
* module('Acceptance | my test', function(hooks) {
|
||||
* setupApplicationTest(hooks);
|
||||
* setupIndexedDb(hooks);
|
||||
*
|
||||
* // add your actual tests here
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param hooks
|
||||
*/
|
||||
export function setupIndexedDb(hooks) {
|
||||
hooks.beforeEach(async function () {
|
||||
const indexedDb = this.owner.lookup('service:indexed-db');
|
||||
await indexedDb.setup(`test-indexed-db-${Date.now()}`);
|
||||
});
|
||||
|
||||
hooks.afterEach(async function () {
|
||||
const indexedDb = this.owner.lookup('service:indexed-db');
|
||||
|
||||
await indexedDb.db.delete();
|
||||
});
|
||||
}
|
||||
|
||||
export default setupIndexedDb;
|
||||
@@ -1,240 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import { modelIndexes } from 'api/services/indexed-db';
|
||||
import { service } from '@ember/service';
|
||||
import { getOwner, setOwner } from '@ember/application';
|
||||
import { queryIndexedDb } from '../utils/indexed-db-query';
|
||||
import { paginateResults } from '../utils/paginate-results';
|
||||
import { sortResults } from '../utils/sort-results';
|
||||
import { hashCode } from '../utils/hash-code';
|
||||
|
||||
/**
|
||||
* Handler to sit in front of the API request layer
|
||||
* so we can handle any caching with indexedDb first
|
||||
*/
|
||||
export default class IndexedDbHandler {
|
||||
@service indexedDb;
|
||||
|
||||
batchLimit = 10_000;
|
||||
|
||||
constructor(context) {
|
||||
setOwner(this, getOwner(context));
|
||||
}
|
||||
|
||||
async request(context, next) {
|
||||
const { batchLimit } = this;
|
||||
|
||||
switch (context.request.op) {
|
||||
case 'query': {
|
||||
const { store, data } = context.request;
|
||||
// TODO: Remove storeToken option as this is a temporary fix for auth-methods.
|
||||
const {
|
||||
type,
|
||||
query,
|
||||
options: {
|
||||
pushToStore = true,
|
||||
peekDb = false,
|
||||
storeToken = true,
|
||||
} = {},
|
||||
} = data;
|
||||
const supportedModels = Object.keys(modelIndexes);
|
||||
const { db: indexedDb } = this.indexedDb ?? {};
|
||||
|
||||
// Go through normal flow if we don't yet support the model
|
||||
// or if we don't have an indexedDb instance
|
||||
if (!supportedModels.includes(type) || !indexedDb) {
|
||||
return next(context.request);
|
||||
}
|
||||
|
||||
let { page, pageSize, query: queryObj, ...remainingQuery } = query;
|
||||
|
||||
const adapter = store.adapterFor(type);
|
||||
const schema = store.modelFor(type);
|
||||
const serializer = store.serializerFor(type);
|
||||
|
||||
if (!peekDb) {
|
||||
const tokenKey = `${type}-${hashCode(remainingQuery)}`;
|
||||
let payload;
|
||||
let listToken;
|
||||
let writeToIndexedDbPromise;
|
||||
|
||||
if (storeToken) {
|
||||
const tokenObj = await indexedDb.token.get(tokenKey);
|
||||
listToken = tokenObj?.token;
|
||||
} else {
|
||||
// This is a temporary fix of clearing the DB (specifically for auth-methods)
|
||||
// since we are not storing the token we do not get back a list of removed_ids
|
||||
// from the API call and we do not want deleted items from showing in list view.
|
||||
await indexedDb[type].clear();
|
||||
}
|
||||
|
||||
do {
|
||||
try {
|
||||
payload = await adapter.query(store, schema, {
|
||||
...remainingQuery,
|
||||
list_token: listToken,
|
||||
batchLimit: batchLimit,
|
||||
});
|
||||
|
||||
// await the previous writeToIndexedDbPromise before writing to indexedDb again
|
||||
if (writeToIndexedDbPromise) {
|
||||
await writeToIndexedDbPromise;
|
||||
}
|
||||
} catch (err) {
|
||||
payload = await this.retryQueryFailure({
|
||||
err,
|
||||
indexedDb,
|
||||
type,
|
||||
adapter,
|
||||
store,
|
||||
schema,
|
||||
remainingQuery,
|
||||
});
|
||||
}
|
||||
listToken = payload.list_token;
|
||||
|
||||
// Don't await immediately and let the next query run while we write to indexedDb
|
||||
writeToIndexedDbPromise = this.writeToIndexedDb({
|
||||
payload,
|
||||
storeToken,
|
||||
indexedDb,
|
||||
tokenKey,
|
||||
type,
|
||||
serializer,
|
||||
store,
|
||||
schema,
|
||||
});
|
||||
} while (payload.response_type === 'delta');
|
||||
|
||||
await writeToIndexedDbPromise;
|
||||
}
|
||||
|
||||
// Results returned in JSON API reponse, but in a format optimized for indexedDb
|
||||
const indexedDbResults = await queryIndexedDb(
|
||||
indexedDb,
|
||||
type,
|
||||
queryObj,
|
||||
);
|
||||
|
||||
// Normalize the results and clean up indexedDb format, ready for ember data consumption
|
||||
const normalizedResults = indexedDbResults.map((item) => {
|
||||
return this.indexedDb.normalizeData({
|
||||
data: item,
|
||||
cleanData: false,
|
||||
schema,
|
||||
serializer,
|
||||
});
|
||||
});
|
||||
|
||||
// Sort the results
|
||||
const sortedResults = sortResults(normalizedResults, {
|
||||
querySort: queryObj?.sort,
|
||||
schema,
|
||||
});
|
||||
|
||||
// Paginate the results
|
||||
const paginatedResults = paginateResults(sortedResults, page, pageSize);
|
||||
|
||||
// If we are not pushing to the store, use the raw data with id property
|
||||
const records = pushToStore
|
||||
? store.push({ data: paginatedResults })
|
||||
: paginatedResults.map((record) => ({
|
||||
...record.attributes,
|
||||
id: record.id,
|
||||
}));
|
||||
|
||||
// Set a meta property on the array to store the total items of the results.
|
||||
// This isn't conventional but is better than returning an ArrayProxy
|
||||
// or EmberArray since the ember store query method asserts it has to be an array
|
||||
// so we can't just return an object.
|
||||
records.meta = { totalItems: indexedDbResults.length };
|
||||
return records;
|
||||
}
|
||||
default:
|
||||
return next(context.request);
|
||||
}
|
||||
}
|
||||
|
||||
async retryQueryFailure({
|
||||
err,
|
||||
indexedDb,
|
||||
type,
|
||||
adapter,
|
||||
store,
|
||||
schema,
|
||||
remainingQuery,
|
||||
}) {
|
||||
// If we get an invalid list token, we'll delete the token and
|
||||
// clear the DB and try again without a token.
|
||||
if (
|
||||
err?.errors[0].status === 400 &&
|
||||
err?.errors[0].code === 'invalid list token'
|
||||
) {
|
||||
await indexedDb[type].clear();
|
||||
// Delete all tokens of the same resource type so we don't keep clearing the DB.
|
||||
// Even if other tokens may still be valid, we might have cleared data that they
|
||||
// depended on so we should clear all tokens of the same type when clearing the DB.
|
||||
const tokenKeys = await indexedDb.token
|
||||
.where(':id')
|
||||
.startsWith(type)
|
||||
.primaryKeys();
|
||||
|
||||
await indexedDb.token.bulkDelete(tokenKeys);
|
||||
|
||||
return await adapter.query(store, schema, {
|
||||
...remainingQuery,
|
||||
});
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
async writeToIndexedDb({
|
||||
payload,
|
||||
storeToken,
|
||||
indexedDb,
|
||||
tokenKey,
|
||||
type,
|
||||
serializer,
|
||||
store,
|
||||
schema,
|
||||
}) {
|
||||
// Store the token we just got back from the payload if it exists
|
||||
if (payload.list_token && storeToken) {
|
||||
await indexedDb.token.put({
|
||||
id: tokenKey,
|
||||
token: payload.list_token,
|
||||
});
|
||||
}
|
||||
|
||||
// Remove any records from the DB if the API indicates they've been deleted
|
||||
if (payload.removed_ids?.length > 0) {
|
||||
await indexedDb[type].bulkDelete(payload.removed_ids);
|
||||
}
|
||||
|
||||
const normalizedPayload = serializer.normalizeResponse(
|
||||
store,
|
||||
schema,
|
||||
payload,
|
||||
null,
|
||||
'query',
|
||||
);
|
||||
|
||||
const { data: payloadData } = normalizedPayload;
|
||||
|
||||
// Store the new data we just got back from the API refresh
|
||||
const items = payloadData.map((datum) =>
|
||||
this.indexedDb.normalizeData({
|
||||
data: datum,
|
||||
cleanData: true,
|
||||
schema,
|
||||
serializer,
|
||||
}),
|
||||
);
|
||||
|
||||
await indexedDb[type].bulkPut(items);
|
||||
}
|
||||
}
|
||||
@@ -1,170 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import Service from '@ember/service';
|
||||
import Dexie from 'dexie';
|
||||
import { typeOf } from '@ember/utils';
|
||||
|
||||
// List of resources we support to be cached and searched in
|
||||
// indexedDb. Any field that can be searched upon should be added to
|
||||
// this index. Increment the version number of the database whenever
|
||||
// indexes change.
|
||||
export const modelIndexes = {
|
||||
token: '&id, token',
|
||||
target:
|
||||
'&id, attributes.created_time, attributes.type, attributes.name, attributes.description, attributes.address, attributes.scope.scope_id',
|
||||
session:
|
||||
'&id, attributes.created_time, attributes.type, attributes.status, attributes.endpoint, attributes.target_id, attributes.user_id, attributes.scope.scope_id',
|
||||
user: '&id, attributes.created_time, attributes.name, attributes.description, attributes.scope.scope_id',
|
||||
group:
|
||||
'&id, attributes.created_time, attributes.name, attributes.description, attributes.scope.scope_id',
|
||||
role: '&id, attributes.created_time, attributes.name, attributes.description, attributes.scope.scope_id',
|
||||
scope:
|
||||
'&id, attributes.created_time, attributes.type, attributes.name, attributes.description, attributes.scope.scope_id',
|
||||
'credential-store':
|
||||
'&id, attributes.created_time, attributes.name, attributes.description, attributes.type, attributes.scope.scope_id',
|
||||
'host-catalog':
|
||||
'&id, attributes.created_time, attributes.type, attributes.name, attributes.description, attributes.scope.scope_id, attributes.plugin.name',
|
||||
'auth-method':
|
||||
'&id, attributes.created_time, attributes.type, attributes.name, attributes.description, attributes.is_primary, attributes.scope.scope_id',
|
||||
'session-recording':
|
||||
'&id, attributes.created_time, attributes.type, attributes.state, attributes.start_time, attributes.end_time, attributes.duration, attributes.scope.scope_id, attributes.create_time_values.user.id, attributes.create_time_values.user.name, attributes.create_time_values.target.id, attributes.create_time_values.target.name, attributes.create_time_values.target.scope.id, attributes.create_time_values.target.scope.name',
|
||||
alias:
|
||||
'&id, attributes.created_time, attributes.type, attributes.value, attributes.name, attributes.description, attributes.destination_id, attributes.scope.scope_id',
|
||||
};
|
||||
|
||||
export const formatDbName = (userId, clusterUrl) =>
|
||||
`boundary-${userId}-${clusterUrl}`;
|
||||
|
||||
/**
|
||||
* Recursively copy over the object and convert any booleans to "true" or "false" so they can be indexed.
|
||||
* Also converts any ember-like arrays back to a standard array.
|
||||
* @param result
|
||||
* @param object
|
||||
* @returns {*}
|
||||
*/
|
||||
const convertFields = (result, object) => {
|
||||
Object.entries(object).forEach(([key, value]) => {
|
||||
if (typeOf(value) === 'object') {
|
||||
result[key] = convertFields({}, value);
|
||||
} else if (typeOf(value) === 'boolean') {
|
||||
result[key] = value ? 'true' : 'false';
|
||||
} else if (typeOf(value) === 'array') {
|
||||
result[key] = [...value];
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Recursively copy over the object and convert any string "true" or "false" back to booleans.
|
||||
* Will also convert any array fields back using their model transformation.
|
||||
* @param result
|
||||
* @param object
|
||||
* @param schema
|
||||
* @param serializer
|
||||
* @returns {*}
|
||||
*/
|
||||
const unconvertFields = (result, object, schema, serializer) => {
|
||||
Object.entries(object).forEach(([key, value]) => {
|
||||
if (typeOf(value) === 'object') {
|
||||
result[key] = unconvertFields({}, value, schema, serializer);
|
||||
} else if (value === 'true' || value === 'false') {
|
||||
result[key] = value === 'true';
|
||||
} else if (typeOf(value) === 'array') {
|
||||
const attribute = schema.attributes.get(key);
|
||||
|
||||
// If attribute type is array, we transform it back to a tracked array
|
||||
if (attribute?.type === 'array') {
|
||||
const transformer = serializer.transformFor(attribute.type);
|
||||
result[key] = transformer.deserialize(value, attribute.options);
|
||||
return;
|
||||
}
|
||||
|
||||
result[key] = value;
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
});
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Service to encapsulate the IndexedDB implementation. To use this service, call
|
||||
* `setup` from the application root. This will create the database and the necessary indexes.
|
||||
*
|
||||
* Make sure to increment the version number of the database whenever the indexes change.
|
||||
* This will delete the old database and create a new one with the new indexes.
|
||||
*/
|
||||
export default class IndexedDbService extends Service {
|
||||
// =attributes
|
||||
#db;
|
||||
#version = 2;
|
||||
|
||||
get db() {
|
||||
return this.#db;
|
||||
}
|
||||
|
||||
async setup(dbName) {
|
||||
// Don't run setup again if we already have one or if we didn't get a name
|
||||
if (this.#db || !dbName) {
|
||||
return;
|
||||
}
|
||||
|
||||
const doesDbExist = await Dexie.exists(dbName);
|
||||
|
||||
// If the database already exists, open the database and
|
||||
// check if the version is a lower version than the current one
|
||||
if (doesDbExist) {
|
||||
const dbVerifier = new Dexie(dbName);
|
||||
await dbVerifier.open();
|
||||
if (dbVerifier.verno < this.#version) {
|
||||
await dbVerifier.delete();
|
||||
} else {
|
||||
dbVerifier.close();
|
||||
}
|
||||
}
|
||||
|
||||
this.#db = new Dexie(dbName);
|
||||
this.#db.version(this.#version).stores(modelIndexes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup the data by converting all fields to plain javascript objects.
|
||||
* We will also convert booleans to "false" or "true".
|
||||
* IndexedDB doesn't support indexes on boolean values so we have to
|
||||
* convert them to be able to support using boolean values.
|
||||
*
|
||||
* Undo the operation by setting `convertFields` to false.
|
||||
*
|
||||
* @param {Object} data
|
||||
* @param {Boolean} cleanData
|
||||
* @param {Object} schema
|
||||
* @param {Object} serializer
|
||||
* @return {{id, type, attributes: {}, relationships: {}}}
|
||||
*/
|
||||
normalizeData({ data, cleanData, schema, serializer }) {
|
||||
if (!data) {
|
||||
return data;
|
||||
}
|
||||
|
||||
let { id, type, attributes = {}, relationships = {} } = data;
|
||||
|
||||
return {
|
||||
id,
|
||||
type,
|
||||
attributes: cleanData
|
||||
? convertFields({}, attributes)
|
||||
: unconvertFields({}, attributes, schema, serializer),
|
||||
relationships: cleanData
|
||||
? convertFields({}, relationships)
|
||||
: unconvertFields({}, relationships, schema, serializer),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@
|
||||
import Service from '@ember/service';
|
||||
import { PWBHost } from 'promise-worker-bi';
|
||||
|
||||
export const formatDbName = (userId, clusterUrl) =>
|
||||
`boundary-${userId}-${clusterUrl}`;
|
||||
|
||||
// A mapping of columns to their expected model attributes for supported models
|
||||
// The JSON data column is not included here but is assumed to always be last.
|
||||
export const modelMapping = {
|
||||
|
||||
@@ -10,7 +10,6 @@ import Store from 'ember-data/store';
|
||||
import { CacheHandler } from '@ember-data/store';
|
||||
import RequestManager from '@ember-data/request';
|
||||
import { LegacyNetworkHandler } from '@ember-data/legacy-compat';
|
||||
import IndexedDbHandler from 'api/handlers/indexed-db-handler';
|
||||
import SqliteHandler from 'api/handlers/sqlite-handler';
|
||||
|
||||
export default class extends Store {
|
||||
@@ -19,14 +18,9 @@ export default class extends Store {
|
||||
constructor(args) {
|
||||
super(args);
|
||||
|
||||
const indexedDbHandler = new IndexedDbHandler(this);
|
||||
const sqliteHandler = new SqliteHandler(this);
|
||||
|
||||
this.requestManager.use([
|
||||
sqliteHandler,
|
||||
indexedDbHandler,
|
||||
LegacyNetworkHandler,
|
||||
]);
|
||||
this.requestManager.use([sqliteHandler, LegacyNetworkHandler]);
|
||||
this.requestManager.useCache(CacheHandler);
|
||||
}
|
||||
}
|
||||
@@ -1,258 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import { get } from '@ember/object';
|
||||
import { modelIndexes } from '../services/indexed-db';
|
||||
|
||||
/**
|
||||
* Takes a POJO representing a filter query and builds a query to
|
||||
* query indexedDb with. Note that the first filter is important as that
|
||||
* will use the actual index in indexedDb while any subsequent ones will be less efficient.
|
||||
*
|
||||
* @example
|
||||
* const filter = queryIndexedDb(indexedDb, type, {
|
||||
* search: generated',
|
||||
* filters: {
|
||||
* scope_id: {
|
||||
* logicalOperator: 'and',
|
||||
* values: [{ notEquals: 'scope1' }, { notEquals: 'scope2' }],
|
||||
* },
|
||||
* },
|
||||
* });
|
||||
*/
|
||||
export async function queryIndexedDb(indexedDb, resource, query) {
|
||||
let { search, filters = {} } = query ?? {};
|
||||
let filterCollection = indexedDb[resource];
|
||||
|
||||
search = getSearchObject(search, resource);
|
||||
filters = cleanObject(filters);
|
||||
|
||||
if (Object.keys(filters).length) {
|
||||
// Remove the first item to use as the initial collection and then reduce the remaining ones
|
||||
const entries = Object.entries(filters);
|
||||
const [firstKey, firstFilterArrayOrObject] = entries.shift();
|
||||
|
||||
filterCollection = await entries.reduce(
|
||||
async (currCollection, [key, filterArrayOrObject]) => {
|
||||
// Grab the results from the set of one filters to be `AND` together with the rest of the filters
|
||||
const filterResults = await buildInitialWhereClause({
|
||||
table: indexedDb[resource],
|
||||
key,
|
||||
filterArrayOrObject,
|
||||
}).primaryKeys();
|
||||
const resultIdsSet = new Set(filterResults);
|
||||
|
||||
return (await currCollection).and((record) => {
|
||||
return resultIdsSet.has(record.id);
|
||||
});
|
||||
},
|
||||
buildInitialWhereClause({
|
||||
key: firstKey,
|
||||
table: indexedDb[resource],
|
||||
filterArrayOrObject: firstFilterArrayOrObject,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (search) {
|
||||
const { text, fields } = search;
|
||||
|
||||
filterCollection = filterCollection.filter((record) =>
|
||||
fields
|
||||
.map((key) => get(record, key))
|
||||
.some((element) => {
|
||||
if (typeof element === 'string') {
|
||||
return element?.toLowerCase().includes(text?.toLowerCase());
|
||||
}
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
// filterCollection can be Dexie Table or a Dexie Collection.
|
||||
// This is an important detail you need to keep in mind when working on it.
|
||||
return filterCollection.toArray();
|
||||
}
|
||||
|
||||
const buildInitialWhereClause = ({ filterArrayOrObject, table, key }) => {
|
||||
const filterValueArray = Array.isArray(filterArrayOrObject)
|
||||
? filterArrayOrObject
|
||||
: filterArrayOrObject.values;
|
||||
|
||||
const { logicalOperator } = filterArrayOrObject;
|
||||
|
||||
// Short circuit if all the filter types were equals or notEquals since indexedDb
|
||||
// can more efficiently query if we pass all values at once
|
||||
const checkAllFilterType = (type) =>
|
||||
filterValueArray.every((obj) => Object.keys(obj)[0] === type);
|
||||
if (checkAllFilterType('equals')) {
|
||||
return table
|
||||
.where(getKey(key))
|
||||
.anyOf(filterValueArray.map((obj) => obj['equals']));
|
||||
}
|
||||
if (checkAllFilterType('notEquals')) {
|
||||
return table
|
||||
.where(getKey(key))
|
||||
.noneOf(filterValueArray.map((obj) => obj['notEquals']));
|
||||
}
|
||||
|
||||
// Remove the first item to use as the initial where clause and then reduce the remaining ones
|
||||
const [firstOperation, firstFilterValue] = Object.entries(
|
||||
filterValueArray[0],
|
||||
)[0];
|
||||
|
||||
// Not all are filters are equals or notEquals,
|
||||
// manually build the initial where clause and resulting collections
|
||||
return filterValueArray.slice(1).reduce(
|
||||
(result, currObj) => {
|
||||
const [operation, value] = Object.entries(currObj)[0];
|
||||
|
||||
return buildIndexedDbCollection({
|
||||
key: getKey(key),
|
||||
value,
|
||||
collection: result,
|
||||
operation,
|
||||
logicalOperator,
|
||||
});
|
||||
},
|
||||
buildIndexedDbWhere({
|
||||
table,
|
||||
key: getKey(key),
|
||||
operation: firstOperation,
|
||||
value: firstFilterValue,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Builds the initial where clause for indexed DB to filter on. Note that this makes
|
||||
* the first filter important as that will do the real filtering from indexed DB while
|
||||
* any subsequent filter has to be done in memory.
|
||||
*/
|
||||
const buildIndexedDbWhere = ({ table, key, value, operation }) => {
|
||||
const baseWhereClause = table.where(key);
|
||||
switch (operation) {
|
||||
case 'contains':
|
||||
// We return an error due to not being able to support contains on first filter due to performance.
|
||||
throw new Error('Contains is not supported as the first filter.');
|
||||
case 'gt':
|
||||
return baseWhereClause.above(value);
|
||||
case 'gte':
|
||||
return baseWhereClause.aboveOrEqual(value);
|
||||
case 'lt':
|
||||
return baseWhereClause.below(value);
|
||||
case 'lte':
|
||||
return baseWhereClause.belowOrEqual(value);
|
||||
case 'notEquals':
|
||||
return baseWhereClause.notEqual(value);
|
||||
default:
|
||||
return baseWhereClause.equals(value);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Continues building the queries for indexed DB to filter on. Note that these are not true
|
||||
* indexed DB queries and in fact just standard JS filters for logical "and" queries and parallel queries
|
||||
* to indexed DB for logical "or" queries that get deduped.
|
||||
*/
|
||||
const buildIndexedDbCollection = ({
|
||||
key,
|
||||
value,
|
||||
collection,
|
||||
operation,
|
||||
logicalOperator,
|
||||
}) => {
|
||||
if (logicalOperator === 'and') {
|
||||
switch (operation) {
|
||||
case 'contains':
|
||||
return collection.and((record) => get(record, key)?.includes(value));
|
||||
case 'gt':
|
||||
return collection.and((record) => get(record, key) > value);
|
||||
case 'gte':
|
||||
return collection.and((record) => get(record, key) >= value);
|
||||
case 'lt':
|
||||
return collection.and((record) => get(record, key) < value);
|
||||
case 'lte':
|
||||
return collection.and((record) => get(record, key) <= value);
|
||||
case 'notEquals':
|
||||
return collection.and((record) => get(record, key) !== value);
|
||||
default:
|
||||
return collection.and((record) => get(record, key) === value);
|
||||
}
|
||||
}
|
||||
|
||||
switch (operation) {
|
||||
case 'contains':
|
||||
// We return an error due to not being able to support contains on this filter due to performance.
|
||||
throw new Error(
|
||||
'Contains is not supported as a filter option with "or" operator.',
|
||||
);
|
||||
case 'gt':
|
||||
return collection.or(key).above(value);
|
||||
case 'gte':
|
||||
return collection.or(key).aboveOrEqual(value);
|
||||
case 'lt':
|
||||
return collection.or(key).below(value);
|
||||
case 'lte':
|
||||
return collection.or(key).belowOrEqual(value);
|
||||
case 'notEquals':
|
||||
return collection.or(key).notEqual(value);
|
||||
default:
|
||||
return collection.or(key).equals(value);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Translates the fields passed in from the UI for resources to the keys indexed DB knows them as.
|
||||
* Usually it's the path of the actual normalized model.
|
||||
*/
|
||||
const getKey = (key) => {
|
||||
switch (key) {
|
||||
case 'scope_id':
|
||||
return `attributes.scope.${key}`;
|
||||
case 'id':
|
||||
return key;
|
||||
default:
|
||||
return `attributes.${key}`;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleans the object to remove any keys that have a value of an empty array. This makes
|
||||
* it easier so we don't have to worry about empty arrays getting queried in indexed db.
|
||||
*/
|
||||
const cleanObject = (obj) => {
|
||||
if (!obj) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return Object.entries(obj).reduce((result, [key, value]) => {
|
||||
if (Array.isArray(value)) {
|
||||
if (value.length > 0) {
|
||||
result[key] = value;
|
||||
}
|
||||
} else if (value.values.length > 0) {
|
||||
result[key] = value;
|
||||
}
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes the search object that is expected when a user searches. Uses
|
||||
* the indexes we setup in indexed db.
|
||||
*/
|
||||
const getSearchObject = (text, resource) => {
|
||||
if (!text) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
text,
|
||||
fields: modelIndexes[resource]
|
||||
.split(', ')
|
||||
.map((index) => index.replace('&', '')),
|
||||
};
|
||||
};
|
||||
@@ -1,116 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
// created_time is not an attribute defined on all models, but is present in all the resources
|
||||
// coming from API
|
||||
const SORT_DEFAULT_ATTRIBUTE = 'created_time';
|
||||
const SORT_DIRECTION_ASCENDING = 'asc';
|
||||
const SORT_DIRECTION_DESCENDING = 'desc';
|
||||
|
||||
const sortFunctions = {
|
||||
string: (a, b) =>
|
||||
String(a).localeCompare(String(b), navigator.language, {
|
||||
caseFirst: 'upper',
|
||||
}),
|
||||
date: (a, b) => new Date(a).getTime() - new Date(b).getTime(),
|
||||
number: (a, b) => Number(a) - Number(b),
|
||||
boolean: (a, b) => Number(a) - Number(b),
|
||||
};
|
||||
|
||||
function getSortableValue(schema, record, attribute) {
|
||||
if (attribute === 'id') {
|
||||
return record.id;
|
||||
}
|
||||
|
||||
// all models have a created_time attribute but not all models have it defined
|
||||
if (attribute === 'created_time') {
|
||||
return record.attributes.created_time;
|
||||
}
|
||||
|
||||
if (schema.attributes.has(attribute)) {
|
||||
return record.attributes[attribute];
|
||||
}
|
||||
|
||||
const attributes = Array.from(schema.attributes.keys());
|
||||
throw new Error(
|
||||
`The attribute "${attribute}" does not map to the model definition of type "${record.type}". Supported sortable attributes are 'id', 'created_time', or ${attributes.map((attr) => `'${attr}'`).join(', ')}`,
|
||||
);
|
||||
}
|
||||
|
||||
export const sortResults = (results, { querySort, schema }) => {
|
||||
querySort = querySort ?? {};
|
||||
const sortAttribute = querySort.attributes?.[0] || SORT_DEFAULT_ATTRIBUTE;
|
||||
|
||||
// Default sort direction is ascending unless we are sorting by `created_time` (default sort attribute)
|
||||
const defaultSortDirection =
|
||||
sortAttribute === SORT_DEFAULT_ATTRIBUTE
|
||||
? SORT_DIRECTION_DESCENDING
|
||||
: SORT_DIRECTION_ASCENDING;
|
||||
const sortDirection = querySort.direction || defaultSortDirection;
|
||||
|
||||
if (
|
||||
![SORT_DIRECTION_ASCENDING, SORT_DIRECTION_DESCENDING].includes(
|
||||
sortDirection,
|
||||
)
|
||||
) {
|
||||
throw new Error('Invalid sort direction');
|
||||
}
|
||||
|
||||
const sortAttributeDataType = schema.attributes.get(sortAttribute)?.type;
|
||||
|
||||
const sortFunction =
|
||||
sortFunctions[sortAttributeDataType] ?? sortFunctions.string;
|
||||
|
||||
// Execute custom sort for multiple attributes provided.
|
||||
if (querySort.attributes?.length > 1) {
|
||||
const { attributes } = querySort;
|
||||
return results.toSorted((a, b) => {
|
||||
let sortValueA, sortValueB;
|
||||
|
||||
attributes.forEach((attr) => {
|
||||
const valueA = getSortableValue(schema, a, attr);
|
||||
const valueB = getSortableValue(schema, b, attr);
|
||||
|
||||
if (valueA && !sortValueA) {
|
||||
sortValueA = valueA;
|
||||
}
|
||||
if (valueB && !sortValueB) {
|
||||
sortValueB = valueB;
|
||||
}
|
||||
});
|
||||
const sortResult = sortFunction(sortValueA, sortValueB);
|
||||
return sortDirection === SORT_DIRECTION_ASCENDING
|
||||
? sortResult
|
||||
: -1 * sortResult;
|
||||
});
|
||||
}
|
||||
// Execute custom sort for attribute map provided.
|
||||
if (querySort.customSort) {
|
||||
const { attributeMap } = querySort.customSort;
|
||||
return results.toSorted((a, b) => {
|
||||
const sortValueA = getSortableValue(schema, a, sortAttribute);
|
||||
const sortValueB = getSortableValue(schema, b, sortAttribute);
|
||||
const sortResult = sortFunction(
|
||||
attributeMap[sortValueA],
|
||||
attributeMap[sortValueB],
|
||||
);
|
||||
|
||||
return sortDirection === SORT_DIRECTION_ASCENDING
|
||||
? sortResult
|
||||
: -1 * sortResult;
|
||||
});
|
||||
}
|
||||
|
||||
return results.toSorted((a, b) => {
|
||||
// Extract the values to sort and sort them.
|
||||
const sortValueA = getSortableValue(schema, a, sortAttribute);
|
||||
const sortValueB = getSortableValue(schema, b, sortAttribute);
|
||||
const sortResult = sortFunction(sortValueA, sortValueB);
|
||||
|
||||
return sortDirection === SORT_DIRECTION_ASCENDING
|
||||
? sortResult
|
||||
: -1 * sortResult;
|
||||
});
|
||||
};
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
export { default } from 'api/services/indexed-db';
|
||||
@@ -32,7 +32,6 @@
|
||||
"broccoli-merge-trees": "^4.2.0",
|
||||
"broccoli-plugin": "^4.0.7",
|
||||
"broccoli-source": "^3.0.1",
|
||||
"dexie": "^3.2.4",
|
||||
"ember-auto-import": "^2.10.0",
|
||||
"ember-can": "^4.2.0",
|
||||
"ember-cli-babel": "^8.2.0",
|
||||
|
||||
@@ -1,494 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import IndexedDbHandler from 'api/handlers/indexed-db-handler';
|
||||
import RequestManager from '@ember-data/request';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import sinon from 'sinon';
|
||||
import { assert } from '@ember/debug';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import TargetModel from 'api/models/target';
|
||||
|
||||
function createPaginatedResponseHandler(mirageRecords, { pageSize }) {
|
||||
assert('pageSize is required', pageSize);
|
||||
const pagesCount = mirageRecords.length / pageSize;
|
||||
|
||||
const results = [];
|
||||
for (let i = 0; i < pagesCount; i++) {
|
||||
const items = mirageRecords.slice(i * pageSize, (i + 1) * pageSize);
|
||||
const isLastPage = i === pagesCount - 1;
|
||||
const list_token = `list-token-${faker.string.nanoid({ min: 5, max: 5 })}`;
|
||||
|
||||
results.push({
|
||||
items,
|
||||
list_token,
|
||||
response_type: !isLastPage ? 'delta' : 'complete',
|
||||
});
|
||||
}
|
||||
|
||||
function nextResult(listToken) {
|
||||
const index = results.findIndex(
|
||||
({ list_token }) => list_token === listToken,
|
||||
);
|
||||
const nextResult = index === -1 ? null : results[index + 1];
|
||||
return nextResult;
|
||||
}
|
||||
|
||||
// mirage handler compatible with paginated responses
|
||||
return function (_schema, request) {
|
||||
const listToken = request.queryParams.list_token;
|
||||
if (!listToken) {
|
||||
return results[0];
|
||||
}
|
||||
|
||||
const result = nextResult(listToken);
|
||||
|
||||
if (!result) {
|
||||
return new Response(
|
||||
404,
|
||||
{},
|
||||
`No results found for list token "${listToken}"`,
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
module('Unit | Handler | indexed-db-handler', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let manager,
|
||||
indexeddbHandler,
|
||||
store,
|
||||
applicationAdapter,
|
||||
indexedbHandlerSpy,
|
||||
applicationAdapterSpy;
|
||||
hooks.beforeEach(async function setupIndexHandler() {
|
||||
store = this.owner.lookup('service:store');
|
||||
manager = new RequestManager();
|
||||
indexeddbHandler = new IndexedDbHandler(store);
|
||||
applicationAdapter = store.adapterFor('application');
|
||||
|
||||
// spy on all handler and application adapter methods
|
||||
indexedbHandlerSpy = sinon.spy(indexeddbHandler);
|
||||
applicationAdapterSpy = sinon.spy(applicationAdapter);
|
||||
|
||||
store.requestManager = manager;
|
||||
manager.use([indexeddbHandler]);
|
||||
});
|
||||
|
||||
module('fetching and batch loading', function (hooks) {
|
||||
// `testBatchLimit` and `serverResultPageLimit` are intentionally difference
|
||||
// so that multiple calls to the server are required to fetch a single batch,
|
||||
// and these multiples can be asserted in the tests individually
|
||||
const testBatchLimit = 10;
|
||||
const serverResultPageLimit = 5;
|
||||
let aliases, aliasResponseHandlerSpy;
|
||||
|
||||
hooks.beforeEach(function setupMirageData() {
|
||||
indexeddbHandler.batchLimit = testBatchLimit;
|
||||
|
||||
aliases = this.server.createList('alias', 50);
|
||||
|
||||
const aliasResponseHandler = createPaginatedResponseHandler(
|
||||
this.server.schema.aliases.all().models,
|
||||
{ pageSize: serverResultPageLimit },
|
||||
);
|
||||
|
||||
aliasResponseHandlerSpy = sinon.spy(aliasResponseHandler);
|
||||
this.server.get('aliases', aliasResponseHandlerSpy);
|
||||
});
|
||||
|
||||
test('it returns all data for a resource from the server', async function (assert) {
|
||||
const results = await store.query('alias', {});
|
||||
|
||||
assert.strictEqual(
|
||||
aliases.length,
|
||||
results.length,
|
||||
'all records are returned',
|
||||
);
|
||||
|
||||
const aliasesSortedByCreatedTime = [...aliases].sort(
|
||||
(a, b) => new Date(b.created_time) - new Date(a.created_time),
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
aliasesSortedByCreatedTime.map(({ name }) => name),
|
||||
results.map(({ name }) => name),
|
||||
'`name` property matches between the returned results and the mirage records sorted by created_time',
|
||||
);
|
||||
});
|
||||
|
||||
test('supports batching requests and writes to indexedDB', async function (assert) {
|
||||
await store.query('alias', {});
|
||||
|
||||
assert.strictEqual(
|
||||
indexedbHandlerSpy.writeToIndexedDb.callCount,
|
||||
aliases.length / testBatchLimit,
|
||||
'handler #writeToIndexedDb is called once for each batch',
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
applicationAdapterSpy.query.callCount,
|
||||
aliases.length / testBatchLimit,
|
||||
'application adapter #query is called once for each batch',
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
aliasResponseHandlerSpy.callCount,
|
||||
aliases.length / serverResultPageLimit,
|
||||
'server handler should be called once for each page',
|
||||
);
|
||||
});
|
||||
|
||||
test('it loads from indexeddb only and does not fetch from api, when peekDb option is used', async function (assert) {
|
||||
const callCounts = {
|
||||
get writeToIndexedDb() {
|
||||
return indexedbHandlerSpy.writeToIndexedDb.callCount;
|
||||
},
|
||||
get aliasResponseHandler() {
|
||||
return aliasResponseHandlerSpy.callCount;
|
||||
},
|
||||
};
|
||||
|
||||
// before first query, no data has been fetched or written to indexeddb
|
||||
// the call counts should therefore be 0
|
||||
assert.strictEqual(callCounts.aliasResponseHandler, 0);
|
||||
assert.strictEqual(callCounts.writeToIndexedDb, 0);
|
||||
|
||||
const results = await store.query('alias', {});
|
||||
assert.strictEqual(results.length, 50);
|
||||
|
||||
// call counts expected after first query
|
||||
const expectedWriteToIndexedDbCallCount = 5;
|
||||
const expectedResponseHandlerCallCount = 10;
|
||||
|
||||
// first `store.query()` calls api and writes batches to indexededdb
|
||||
assert.strictEqual(
|
||||
callCounts.aliasResponseHandler,
|
||||
expectedResponseHandlerCallCount,
|
||||
);
|
||||
assert.strictEqual(
|
||||
callCounts.writeToIndexedDb,
|
||||
expectedWriteToIndexedDbCallCount,
|
||||
);
|
||||
|
||||
await store.query('alias', {}, { peekDb: true });
|
||||
assert.strictEqual(results.length, 50);
|
||||
|
||||
// second run does not increase call counts to api or writes to indexeddb
|
||||
assert.strictEqual(
|
||||
callCounts.aliasResponseHandler,
|
||||
expectedResponseHandlerCallCount,
|
||||
);
|
||||
assert.strictEqual(
|
||||
callCounts.writeToIndexedDb,
|
||||
expectedWriteToIndexedDbCallCount,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('sorting', function () {
|
||||
test('it sorts by descending `created_time` by default', async function (assert) {
|
||||
const target2020 = this.server.create('target', {
|
||||
name: 'Target 2020',
|
||||
created_time: '2020-01-01T00:00:00Z',
|
||||
});
|
||||
|
||||
const target2021 = this.server.create('target', {
|
||||
name: 'Target 2021',
|
||||
created_time: '2021-01-01T00:00:00Z',
|
||||
});
|
||||
|
||||
const target2022 = this.server.create('target', {
|
||||
name: 'Target 2022',
|
||||
created_time: '2022-01-01T00:00:00Z',
|
||||
});
|
||||
|
||||
const target2023 = this.server.create('target', {
|
||||
name: 'Target 2023',
|
||||
created_time: '2023-01-01T00:00:00Z',
|
||||
});
|
||||
|
||||
const shuffledTargets = faker.helpers.shuffle([
|
||||
target2020,
|
||||
target2021,
|
||||
target2022,
|
||||
target2023,
|
||||
]);
|
||||
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(shuffledTargets, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
const results = await store.query('target', {});
|
||||
assert.deepEqual(
|
||||
results.map(({ name }) => name),
|
||||
['Target 2023', 'Target 2022', 'Target 2021', 'Target 2020'],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by ascending (default) `name` using string sorting', async function (assert) {
|
||||
const target001 = this.server.create('target', { name: 'Target 001' });
|
||||
const target002 = this.server.create('target', { name: 'Target 002' });
|
||||
const target003 = this.server.create('target', { name: 'Target 003' });
|
||||
const target004 = this.server.create('target', { name: 'Target 004' });
|
||||
const target005 = this.server.create('target', { name: 'Target 005' });
|
||||
|
||||
const shuffledTargets = faker.helpers.shuffle([
|
||||
target001,
|
||||
target002,
|
||||
target003,
|
||||
target004,
|
||||
target005,
|
||||
]);
|
||||
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(shuffledTargets, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
const results = await store.query('target', {
|
||||
query: { sort: { attributes: ['name'] } },
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
results.map(({ name }) => name),
|
||||
['Target 001', 'Target 002', 'Target 003', 'Target 004', 'Target 005'],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by descending, then ascending `name` using string sorting', async function (assert) {
|
||||
const alias001 = this.server.create('alias', { name: 'Alias 001' });
|
||||
const alias002 = this.server.create('alias', { name: 'Alias 002' });
|
||||
const alias003 = this.server.create('alias', { name: 'Alias 003' });
|
||||
const alias004 = this.server.create('alias', { name: 'Alias 004' });
|
||||
|
||||
const shuffledAliases = faker.helpers.shuffle([
|
||||
alias001,
|
||||
alias002,
|
||||
alias003,
|
||||
alias004,
|
||||
]);
|
||||
|
||||
this.server.get(
|
||||
'aliases',
|
||||
createPaginatedResponseHandler(shuffledAliases, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
const resultsDesc = await store.query('alias', {
|
||||
query: { sort: { attributes: ['name'], direction: 'desc' } },
|
||||
});
|
||||
const resultsAsc = await store.query('alias', {
|
||||
query: { sort: { attributes: ['name'], direction: 'asc' } },
|
||||
});
|
||||
assert.deepEqual(
|
||||
resultsDesc.map(({ name }) => name),
|
||||
['Alias 004', 'Alias 003', 'Alias 002', 'Alias 001'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
resultsAsc.map(({ name }) => name),
|
||||
['Alias 001', 'Alias 002', 'Alias 003', 'Alias 004'],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by descending, then ascending `name` using custom string sorting', async function (assert) {
|
||||
const alias1 = this.server.create('alias', { name: 'alias1' });
|
||||
const alias2 = this.server.create('alias', { name: 'alias2' });
|
||||
const alias3 = this.server.create('alias', { name: 'alias3' });
|
||||
const alias4 = this.server.create('alias', { name: 'alias4' });
|
||||
|
||||
const nameMap = {
|
||||
alias3: 'Alpha',
|
||||
alias4: 'Beta',
|
||||
alias1: 'Delta',
|
||||
alias2: 'Epsilon',
|
||||
};
|
||||
|
||||
const shuffledAliases = faker.helpers.shuffle([
|
||||
alias1,
|
||||
alias2,
|
||||
alias3,
|
||||
alias4,
|
||||
]);
|
||||
|
||||
this.server.get(
|
||||
'aliases',
|
||||
createPaginatedResponseHandler(shuffledAliases, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
const resultsDesc = await store.query('alias', {
|
||||
query: {
|
||||
sort: {
|
||||
attributes: ['name'],
|
||||
customSort: { attributeMap: nameMap },
|
||||
direction: 'desc',
|
||||
},
|
||||
},
|
||||
});
|
||||
const resultsAsc = await store.query('alias', {
|
||||
query: {
|
||||
sort: {
|
||||
attributes: ['name'],
|
||||
customSort: { attributeMap: nameMap },
|
||||
direction: 'asc',
|
||||
},
|
||||
},
|
||||
});
|
||||
assert.deepEqual(
|
||||
resultsDesc.map(({ name }) => name),
|
||||
['alias2', 'alias1', 'alias4', 'alias3'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
resultsAsc.map(({ name }) => name),
|
||||
['alias3', 'alias4', 'alias1', 'alias2'],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('option: pushToStore', function (hooks) {
|
||||
let mirageTargets;
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
mirageTargets = this.server.createList('target', 5);
|
||||
});
|
||||
|
||||
test('it pushes fetched results to the store by default', async function (assert) {
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(mirageTargets, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
assert.strictEqual(mirageTargets.length, 5);
|
||||
assert.strictEqual(store.peekAll('target').length, 0);
|
||||
const results = await store.query('target', {});
|
||||
assert.strictEqual(results.length, 5);
|
||||
assert.ok(
|
||||
results.every((result) => result instanceof TargetModel),
|
||||
'results are ember data models',
|
||||
);
|
||||
assert.strictEqual(store.peekAll('target').length, 5);
|
||||
});
|
||||
|
||||
test('it pushes fethed results to the store when pushToStore is true', async function (assert) {
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(mirageTargets, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
assert.strictEqual(mirageTargets.length, 5);
|
||||
assert.strictEqual(store.peekAll('target').length, 0);
|
||||
const results = await store.query('target', {}, { pushToStore: true });
|
||||
assert.strictEqual(results.length, 5);
|
||||
assert.ok(
|
||||
results.every((result) => result instanceof TargetModel),
|
||||
'results are ember data models',
|
||||
);
|
||||
assert.strictEqual(store.peekAll('target').length, 5);
|
||||
});
|
||||
|
||||
test('it does not push fetched results to the store when pushToStore is false', async function (assert) {
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(mirageTargets, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
assert.strictEqual(mirageTargets.length, 5);
|
||||
assert.strictEqual(store.peekAll('target').length, 0);
|
||||
const results = await store.query('target', {}, { pushToStore: false });
|
||||
assert.strictEqual(results.length, 5);
|
||||
assert.ok(
|
||||
results.every((result) => !(result instanceof TargetModel)),
|
||||
'results are not ember data models',
|
||||
);
|
||||
assert.strictEqual(store.peekAll('target').length, 0);
|
||||
});
|
||||
});
|
||||
|
||||
test('it supports searching', async function (assert) {
|
||||
this.server.create('target', {
|
||||
name: 'Magical Target',
|
||||
description: 'A target',
|
||||
});
|
||||
|
||||
this.server.create('target', {
|
||||
name: 'Target 2',
|
||||
description: 'Target with magic',
|
||||
});
|
||||
|
||||
this.server.createList('target', 4);
|
||||
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(this.server.schema.targets.all().models, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
const results = await store.query('target', {
|
||||
query: { search: 'magic' },
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
results
|
||||
// search results aren't returning in a consistent order so
|
||||
// the sorting is used to be able to assert
|
||||
.sort((a, b) => (a.name > b.name ? 1 : -1))
|
||||
.map(({ name, description }) => ({ name, description })),
|
||||
[
|
||||
{
|
||||
description: 'A target',
|
||||
name: 'Magical Target',
|
||||
},
|
||||
{
|
||||
description: 'Target with magic',
|
||||
name: 'Target 2',
|
||||
},
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test('it supports filtering', async function (assert) {
|
||||
this.server.create('target', {
|
||||
name: 'specific-target',
|
||||
});
|
||||
|
||||
this.server.createList('target', 5);
|
||||
|
||||
this.server.get(
|
||||
'targets',
|
||||
createPaginatedResponseHandler(this.server.schema.targets.all().models, {
|
||||
pageSize: 1,
|
||||
}),
|
||||
);
|
||||
|
||||
const results = await store.query('target', {
|
||||
query: { filters: { name: [{ equals: 'specific-target' }] } },
|
||||
});
|
||||
|
||||
assert.strictEqual(results[0].name, 'specific-target');
|
||||
});
|
||||
});
|
||||
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'dummy/tests/helpers';
|
||||
import Service from '@ember/service';
|
||||
|
||||
class SessionService extends Service {}
|
||||
|
||||
module('Unit | Service | indexed-db', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
this.owner.register('service:session', SessionService);
|
||||
|
||||
let service = this.owner.lookup('service:indexed-db');
|
||||
assert.ok(service);
|
||||
});
|
||||
});
|
||||
@@ -1,609 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import { queryIndexedDb } from 'api/utils/indexed-db-query';
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { pluralize } from 'ember-inflector';
|
||||
import { camelize } from '@ember/string';
|
||||
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
const seedIndexDb = async (resource, store, indexedDb, server) => {
|
||||
const resourceData =
|
||||
server.schema[pluralize(camelize(resource))].all().models;
|
||||
const serializedData = resourceData.map((resource) =>
|
||||
JSON.parse(JSON.stringify(server.serializerOrRegistry.serialize(resource))),
|
||||
);
|
||||
const serializer = store.serializerFor(resource);
|
||||
const schema = store.modelFor(resource);
|
||||
const normalizedPayload = serializer.normalizeResponse(
|
||||
store,
|
||||
schema,
|
||||
{ items: serializedData },
|
||||
null,
|
||||
'query',
|
||||
);
|
||||
|
||||
await indexedDb.db[resource].bulkPut(
|
||||
normalizedPayload.data.map((datum) =>
|
||||
indexedDb.normalizeData({
|
||||
data: datum,
|
||||
cleanData: true,
|
||||
schema,
|
||||
serializer,
|
||||
}),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
module('Unit | Utility | indexed-db-query', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let indexedDb;
|
||||
let store;
|
||||
|
||||
let scope1;
|
||||
let scope2;
|
||||
const resource = 'target';
|
||||
|
||||
hooks.beforeEach(function () {
|
||||
indexedDb = this.owner.lookup('service:indexed-db');
|
||||
store = this.owner.lookup('service:store');
|
||||
scope1 = this.server.create('scope', {
|
||||
id: 'p_123',
|
||||
type: 'project',
|
||||
});
|
||||
scope2 = this.server.create('scope', {
|
||||
id: 'p_456',
|
||||
type: 'project',
|
||||
});
|
||||
this.server.createList(resource, 5, {
|
||||
type: TYPE_TARGET_SSH,
|
||||
scopeId: scope1.id,
|
||||
});
|
||||
this.server.createList(resource, 5, {
|
||||
type: TYPE_TARGET_TCP,
|
||||
scopeId: scope2.id,
|
||||
});
|
||||
});
|
||||
|
||||
test('it filters by single field', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: [{ equals: TYPE_TARGET_SSH }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "and" logicalOperator', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: TYPE_TARGET_SSH }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "or" logicalOperator', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: {
|
||||
logicalOperator: 'or',
|
||||
values: [{ equals: TYPE_TARGET_SSH }, { equals: TYPE_TARGET_TCP }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it filters by multiple fields', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: [{ equals: TYPE_TARGET_SSH }],
|
||||
scope_id: [{ equals: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by multiple fields with "or" logicalOperator', async function (assert) {
|
||||
this.server.create(resource, { type: TYPE_TARGET_TCP, scopeId: scope1.id });
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: {
|
||||
logicalOperator: 'or',
|
||||
values: [{ equals: TYPE_TARGET_SSH }, { equals: TYPE_TARGET_TCP }],
|
||||
},
|
||||
scope_id: [{ equals: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
assert.strictEqual(result.length, 6);
|
||||
});
|
||||
|
||||
test('it filters by multiple fields with "and" logicalOperator', async function (assert) {
|
||||
this.server.create(resource, { type: TYPE_TARGET_TCP, scopeId: scope1.id });
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: TYPE_TARGET_SSH }, { notEquals: TYPE_TARGET_TCP }],
|
||||
},
|
||||
scope_id: [{ equals: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by multiple fields and uses two "or" logicalOperators', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: {
|
||||
logicalOperator: 'or',
|
||||
values: [{ equals: TYPE_TARGET_SSH }, { equals: TYPE_TARGET_TCP }],
|
||||
},
|
||||
scope_id: {
|
||||
logicalOperator: 'or',
|
||||
values: [{ equals: scope1.id }, { equals: scope2.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it filters by multiple fields and uses two "and" logicalOperators', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ notEquals: TYPE_TARGET_SSH }, { equals: TYPE_TARGET_TCP }],
|
||||
},
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope2.id }, { notEquals: scope1.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it cannot filter with "contains" as initial operation', async function (assert) {
|
||||
assert.expect(1);
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: [{ contains: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
await queryIndexedDb(indexedDb.db, resource, query);
|
||||
} catch (e) {
|
||||
assert.strictEqual(
|
||||
e.message,
|
||||
'Contains is not supported as the first filter.',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test('it cannot filter with "contains" as subsequent operation', async function (assert) {
|
||||
assert.expect(2);
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope1.id }, { contains: scope2.id.slice(0, 2) }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
|
||||
query.filters.scope_id.logicalOperator = 'or';
|
||||
|
||||
try {
|
||||
await queryIndexedDb(indexedDb.db, resource, query);
|
||||
} catch (e) {
|
||||
assert.strictEqual(
|
||||
e.message,
|
||||
'Contains is not supported as a filter option with "or" operator.',
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: Modify test cases that use comparison opertators to compare fields that
|
||||
// are of type number. Additionally, add test case for searching on boolean fields.
|
||||
test('it filters by single field with "gt" as initial operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: [{ gt: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "gt" as subsequent operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope2.id }, { gt: scope1.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
|
||||
query.filters.scope_id.logicalOperator = 'or';
|
||||
|
||||
result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "gte" as initial operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: [{ gte: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it filters by single field with "gte" as subsequent operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope2.id }, { gte: scope1.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
|
||||
query.filters.scope_id.logicalOperator = 'or';
|
||||
|
||||
result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it filters by single field with "lt" as initial operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: [{ lt: scope2.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "lt" as subsequent operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope1.id }, { lt: scope2.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
|
||||
query.filters.scope_id.logicalOperator = 'or';
|
||||
|
||||
result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "lte" as initial operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: [{ lte: scope2.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it filters by single field with "lte" as subsequent operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope1.id }, { lte: scope2.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
|
||||
query.filters.scope_id.logicalOperator = 'or';
|
||||
|
||||
result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it filters by single field with "notEquals" as initial operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: [{ notEquals: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by single field with "notEquals" as subsequent operation', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
scope_id: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ equals: scope2.id }, { notEquals: scope1.id }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
let result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
|
||||
query.filters.scope_id.logicalOperator = 'or';
|
||||
|
||||
result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters and returns zero results', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
type: [{ equals: 'unknown' }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 0);
|
||||
});
|
||||
|
||||
test('it searches with a query that matches a field exactly', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = { search: scope1.id };
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it searches with a query that matches a field partially', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = { search: scope2.id.slice(0, 2) };
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 10);
|
||||
});
|
||||
|
||||
test('it searches and returns no results with a query that matches no fields', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = { search: `${scope1.id}456789` };
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 0);
|
||||
});
|
||||
|
||||
test('it filters by a single field and searches', async function (assert) {
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
search: scope1.id,
|
||||
filters: {
|
||||
type: [{ equals: TYPE_TARGET_SSH }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 5);
|
||||
});
|
||||
|
||||
test('it filters by multiple fields and searches', async function (assert) {
|
||||
const target = this.server.create(resource, {
|
||||
name: 'Generated_ssh_target',
|
||||
type: TYPE_TARGET_SSH,
|
||||
scopeId: scope1.id,
|
||||
});
|
||||
await seedIndexDb(resource, store, indexedDb, this.server);
|
||||
const query = {
|
||||
search: target.name,
|
||||
filters: {
|
||||
type: [{ equals: TYPE_TARGET_SSH }],
|
||||
scope_id: [{ equals: scope1.id }],
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, resource, query);
|
||||
|
||||
assert.strictEqual(result.length, 1);
|
||||
});
|
||||
|
||||
test('it filters on boolean type fields with truthy value', async function (assert) {
|
||||
const authMethod = this.server.create('auth-method', {
|
||||
name: 'Generated_auth_method',
|
||||
scopeId: scope1.id,
|
||||
});
|
||||
scope1.update({ primaryAuthMethodId: authMethod.id });
|
||||
await seedIndexDb('auth-method', store, indexedDb, this.server);
|
||||
const query = { filters: { is_primary: [{ equals: 'true' }] } };
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, 'auth-method', query);
|
||||
|
||||
assert.strictEqual(result.length, 1);
|
||||
});
|
||||
|
||||
test('it filters on boolean type fields with falsy value', async function (assert) {
|
||||
const authMethod = this.server.create('auth-method', {
|
||||
name: 'Generated_auth_method',
|
||||
scopeId: scope1.id,
|
||||
});
|
||||
scope1.update({ primaryAuthMethodId: authMethod.id });
|
||||
await seedIndexDb('auth-method', store, indexedDb, this.server);
|
||||
const query = { filters: { is_primary: [{ equals: 'false' }] } };
|
||||
|
||||
const result = await queryIndexedDb(indexedDb.db, 'auth-method', query);
|
||||
|
||||
assert.strictEqual(result.length, 0);
|
||||
});
|
||||
|
||||
test('it filters on date type fields and returns results', async function (assert) {
|
||||
const pastDate = new Date('2024-09-19T10:00:00.000Z');
|
||||
const createdTime = new Date('2024-09-23T10:00:00.000Z');
|
||||
this.server.create('session-recording', {
|
||||
created_time: createdTime,
|
||||
});
|
||||
await seedIndexDb('session-recording', store, indexedDb, this.server);
|
||||
const query = { filters: { created_time: [{ gte: pastDate }] } };
|
||||
|
||||
const result = await queryIndexedDb(
|
||||
indexedDb.db,
|
||||
'session-recording',
|
||||
query,
|
||||
);
|
||||
|
||||
assert.strictEqual(result.length, 1);
|
||||
});
|
||||
|
||||
test('it filters on date type fields and returns results - from and to', async function (assert) {
|
||||
const from = new Date('2024-09-19T10:00:00.000Z');
|
||||
const to = new Date('2024-09-25T10:00:00.000Z');
|
||||
const createdTime = new Date('2024-09-23T10:00:00.000Z');
|
||||
const createdTime2 = new Date('2024-09-28T10:00:00.000Z');
|
||||
this.server.create('session-recording', {
|
||||
created_time: createdTime,
|
||||
});
|
||||
this.server.create('session-recording', {
|
||||
created_time: createdTime2,
|
||||
});
|
||||
await seedIndexDb('session-recording', store, indexedDb, this.server);
|
||||
const query = {
|
||||
filters: {
|
||||
created_time: {
|
||||
logicalOperator: 'and',
|
||||
values: [{ gte: from }, { lte: to }],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const result = await queryIndexedDb(
|
||||
indexedDb.db,
|
||||
'session-recording',
|
||||
query,
|
||||
);
|
||||
|
||||
assert.strictEqual(result.length, 1);
|
||||
assert.strictEqual(
|
||||
result[0].attributes.created_time.toISOString(),
|
||||
createdTime.toISOString(),
|
||||
);
|
||||
});
|
||||
|
||||
test('it filters on date type fields and returns no results', async function (assert) {
|
||||
const createdTime = faker.date.between({
|
||||
from: '2024-09-19T00:00:00.000Z',
|
||||
to: '2024-09-20T00:00:00.000Z',
|
||||
});
|
||||
const pastDate = faker.date.between({
|
||||
from: '2024-09-23T00:00:00.000Z',
|
||||
to: '2024-09-24T00:00:00.000Z',
|
||||
});
|
||||
this.server.create('session-recording', {
|
||||
created_time: createdTime,
|
||||
});
|
||||
await seedIndexDb('session-recording', store, indexedDb, this.server);
|
||||
const query = { filters: { created_time: [{ gte: pastDate }] } };
|
||||
|
||||
const result = await queryIndexedDb(
|
||||
indexedDb.db,
|
||||
'session-recording',
|
||||
query,
|
||||
);
|
||||
|
||||
assert.strictEqual(result.length, 0);
|
||||
});
|
||||
});
|
||||
@@ -1,541 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) HashiCorp, Inc.
|
||||
* SPDX-License-Identifier: BUSL-1.1
|
||||
*/
|
||||
|
||||
import { assert, module, test } from 'qunit';
|
||||
import { sortResults } from 'api/utils/sort-results';
|
||||
import { faker } from '@faker-js/faker';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
|
||||
function createJsonApiMockRecord(id, type, attributes) {
|
||||
return {
|
||||
id,
|
||||
type,
|
||||
attributes,
|
||||
};
|
||||
}
|
||||
|
||||
module('Unit | Utility | sortResults', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
module('Defaults', function () {
|
||||
test("throws an error when an attribute is not id, created_time or defined as a schema attribute, even when it exists on the record's attribute object", function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'Result 01',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
name: 'Result 02',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
name: 'Result 03',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
]);
|
||||
|
||||
const querySort = { attributes: ['name'] };
|
||||
|
||||
// Note: `name` is not defined as a schema attribute but exists on the record
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('date', { type: 'date' });
|
||||
|
||||
assert.throws(
|
||||
() => sortResults(shuffledResults, { querySort, schema }),
|
||||
/Error: The attribute "name" does not map to the model definition of type "target". Supported sortable attributes are 'id', 'created_time', or 'date'/,
|
||||
);
|
||||
});
|
||||
|
||||
test('throws an error when results do not contain a valid sort direction', function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'Result 01',
|
||||
});
|
||||
|
||||
const querySort = {
|
||||
attributes: ['name'],
|
||||
direction: 'invalid sort direction',
|
||||
};
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('name', { type: 'string' });
|
||||
assert.throws(
|
||||
() => sortResults([result01], { querySort, schema }),
|
||||
/Error: Invalid sort direction/,
|
||||
);
|
||||
});
|
||||
|
||||
test('when passing no querySort, sorts using default created_time, descending order and string sorting', async function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
created_time: '2021',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
created_time: '2022',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
created_time: '2023',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
created_time: '2024',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySort = {};
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('created_time', { type: 'string' });
|
||||
const sortedResults = sortResults(shuffledResults, {
|
||||
querySort,
|
||||
schema,
|
||||
});
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ attributes: { created_time } }) => created_time),
|
||||
['2024', '2023', '2022', '2021'],
|
||||
);
|
||||
});
|
||||
|
||||
test('when sorting by id, without being on the results attributes it sorts as expected ', function () {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'Result 01',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
name: 'Result 02',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
name: 'Result 03',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
name: 'Result 04',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySort = { attributes: ['id'] };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('id', { type: 'string' });
|
||||
const sortedResults = sortResults(shuffledResults, { querySort, schema });
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ id }) => id),
|
||||
['id_01', 'id_02', 'id_03', 'id_04'],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('string sorting', function () {
|
||||
test('it sorts by ascending (default) `name` using string sorting', async function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'Result 01',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
name: 'Result 02',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
name: 'Result 03',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
name: 'Result 04',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySort = { attributes: ['name'] };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('name', { type: 'string' });
|
||||
const sortedResults = sortResults(shuffledResults, { querySort, schema });
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ attributes: { name } }) => name),
|
||||
['Result 01', 'Result 02', 'Result 03', 'Result 04'],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by ascending then descending `name` using string sorting', async function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'Result 01',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
name: 'Result 02',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
name: 'Result 03',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
name: 'Result 04',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySortAsc = { attributes: ['name'], direction: 'asc' };
|
||||
const querySortDesc = { attributes: ['name'], direction: 'desc' };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('name', { type: 'string' });
|
||||
const sortedResultsAsc = sortResults(shuffledResults, {
|
||||
querySort: querySortAsc,
|
||||
schema,
|
||||
});
|
||||
const sortedResultsDesc = sortResults(shuffledResults, {
|
||||
querySort: querySortDesc,
|
||||
schema,
|
||||
});
|
||||
assert.deepEqual(
|
||||
sortedResultsAsc.map(({ attributes: { name } }) => name),
|
||||
['Result 01', 'Result 02', 'Result 03', 'Result 04'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
sortedResultsDesc.map(({ attributes: { name } }) => name),
|
||||
['Result 04', 'Result 03', 'Result 02', 'Result 01'],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by ascending then descending `name` using string sorting with Upper case preference', async function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'orange',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
name: 'Orange',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
name: 'banana',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
name: 'Banana',
|
||||
});
|
||||
const result05 = createJsonApiMockRecord('id_04', 'target', {
|
||||
name: 'apple',
|
||||
});
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
result05,
|
||||
]);
|
||||
const querySortAsc = { attributes: ['name'], direction: 'asc' };
|
||||
const querySortDesc = { attributes: ['name'], direction: 'desc' };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('name', { type: 'string' });
|
||||
|
||||
const sortedResultsAsc = sortResults(shuffledResults, {
|
||||
querySort: querySortAsc,
|
||||
schema,
|
||||
});
|
||||
const sortedResultsDesc = sortResults(shuffledResults, {
|
||||
querySort: querySortDesc,
|
||||
schema,
|
||||
});
|
||||
assert.deepEqual(
|
||||
sortedResultsAsc.map(({ attributes: { name } }) => name),
|
||||
['apple', 'Banana', 'banana', 'Orange', 'orange'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
sortedResultsDesc.map(({ attributes: { name } }) => name),
|
||||
['orange', 'Orange', 'banana', 'Banana', 'apple'],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('date sorting', function () {
|
||||
test('it sorts by ascending (default) `date` using date sorting', function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
date: '2021',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
date: '2022',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
date: '2023',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
date: '2024',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySort = { attributes: ['date'] };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('date', { type: 'date' });
|
||||
|
||||
const sortedResults = sortResults(shuffledResults, { querySort, schema });
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ attributes: { date } }) => date),
|
||||
['2021', '2022', '2023', '2024'],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by ascending then descending `date` using date sorting', function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
date: '2021',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
date: '2022',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
date: '2023',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
date: '2024',
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySortAsc = { attributes: ['date'], direction: 'asc' };
|
||||
const querySortDesc = { attributes: ['date'], direction: 'desc' };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('date', { type: 'date' });
|
||||
|
||||
const sortedResultsAsc = sortResults(shuffledResults, {
|
||||
querySort: querySortAsc,
|
||||
schema,
|
||||
});
|
||||
const sortedResultsDesc = sortResults(shuffledResults, {
|
||||
querySort: querySortDesc,
|
||||
schema,
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResultsAsc.map(({ attributes: { date } }) => date),
|
||||
['2021', '2022', '2023', '2024'],
|
||||
);
|
||||
assert.deepEqual(
|
||||
sortedResultsDesc.map(({ attributes: { date } }) => date),
|
||||
['2024', '2023', '2022', '2021'],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('number sorting', function () {
|
||||
test('it sorts by ascending (default) `sessions`', function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 10,
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 200,
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 3333,
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 40444,
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySort = { attributes: ['sessions'] };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('sessions', { type: 'number' });
|
||||
|
||||
const sortedResults = sortResults(shuffledResults, { querySort, schema });
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ attributes: { sessions } }) => sessions),
|
||||
[10, 200, 3333, 40444],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by ascending then descending `sessions`', function (assert) {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 10,
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 200,
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 3333,
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_01', 'target', {
|
||||
sessions: 40444,
|
||||
});
|
||||
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySortAsc = { attributes: ['sessions'], direction: 'asc' };
|
||||
const querySortDesc = { attributes: ['sessions'], direction: 'desc' };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('sessions', { type: 'number' });
|
||||
|
||||
const sortedResultsAsc = sortResults(shuffledResults, {
|
||||
querySort: querySortAsc,
|
||||
schema,
|
||||
});
|
||||
const sortedResultsDesc = sortResults(shuffledResults, {
|
||||
querySort: querySortDesc,
|
||||
schema,
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResultsAsc.map(({ attributes: { sessions } }) => sessions),
|
||||
[10, 200, 3333, 40444],
|
||||
);
|
||||
assert.deepEqual(
|
||||
sortedResultsDesc.map(({ attributes: { sessions } }) => sessions),
|
||||
[40444, 3333, 200, 10],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('boolean sorting', function () {
|
||||
test('it sorts by ascending (default) `active`', function (assert) {
|
||||
const result01 = { attributes: { active: true } };
|
||||
const result02 = { attributes: { active: false } };
|
||||
const result03 = { attributes: { active: false } };
|
||||
const result04 = { attributes: { active: true } };
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySort = { attributes: ['active'] };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('active', { type: 'boolean' });
|
||||
|
||||
const sortedResults = sortResults(shuffledResults, { querySort, schema });
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ attributes: { active } }) => active),
|
||||
[false, false, true, true],
|
||||
);
|
||||
});
|
||||
|
||||
test('it sorts by ascending then descending `active`', function (assert) {
|
||||
const result01 = { attributes: { active: true } };
|
||||
const result02 = { attributes: { active: false } };
|
||||
const result03 = { attributes: { active: false } };
|
||||
const result04 = { attributes: { active: true } };
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
const querySortAsc = { attributes: ['active'], direction: 'asc' };
|
||||
const querySortDesc = { attributes: ['active'], direction: 'desc' };
|
||||
const schema = { attributes: new Map() };
|
||||
schema.attributes.set('active', { type: 'boolean' });
|
||||
|
||||
const sortedResultsAsc = sortResults(shuffledResults, {
|
||||
querySort: querySortAsc,
|
||||
schema,
|
||||
});
|
||||
const sortedResultsDesc = sortResults(shuffledResults, {
|
||||
querySort: querySortDesc,
|
||||
schema,
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResultsAsc.map(({ attributes: { active } }) => active),
|
||||
[false, false, true, true],
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResultsDesc.map(({ attributes: { active } }) => active),
|
||||
[true, true, false, false],
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
module('custom function sorting', function () {
|
||||
const result01 = createJsonApiMockRecord('id_01', 'target', {
|
||||
name: 'target1',
|
||||
});
|
||||
const result02 = createJsonApiMockRecord('id_02', 'target', {
|
||||
name: 'target2',
|
||||
});
|
||||
const result03 = createJsonApiMockRecord('id_03', 'target', {
|
||||
name: 'target3',
|
||||
});
|
||||
const result04 = createJsonApiMockRecord('id_04', 'target', {
|
||||
name: 'target4',
|
||||
});
|
||||
|
||||
const nameMap = {
|
||||
target3: 'Alpha',
|
||||
target4: 'Beta',
|
||||
target1: 'Delta',
|
||||
target2: 'Epsilon',
|
||||
};
|
||||
|
||||
const schema = { attributes: new Map() };
|
||||
|
||||
test.each(
|
||||
'it sorts by `name` using custom sorting function',
|
||||
{
|
||||
'ascending (default)': {
|
||||
querySort: {
|
||||
attributes: ['name'],
|
||||
customSort: { attributeMap: nameMap },
|
||||
},
|
||||
expectedResults: ['target3', 'target4', 'target1', 'target2'],
|
||||
},
|
||||
descending: {
|
||||
querySort: {
|
||||
attributes: ['name'],
|
||||
customSort: { attributeMap: nameMap },
|
||||
direction: 'desc',
|
||||
},
|
||||
expectedResults: ['target2', 'target1', 'target4', 'target3'],
|
||||
},
|
||||
ascending: {
|
||||
querySort: {
|
||||
attributes: ['name'],
|
||||
customSort: { attributeMap: nameMap },
|
||||
direction: 'asc',
|
||||
},
|
||||
expectedResults: ['target3', 'target4', 'target1', 'target2'],
|
||||
},
|
||||
},
|
||||
function (assert, input) {
|
||||
const shuffledResults = faker.helpers.shuffle([
|
||||
result01,
|
||||
result02,
|
||||
result03,
|
||||
result04,
|
||||
]);
|
||||
schema.attributes.set('name', { type: 'string' });
|
||||
const sortedResults = sortResults(shuffledResults, {
|
||||
querySort: input.querySort,
|
||||
schema,
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
sortedResults.map(({ attributes: { name } }) => name),
|
||||
input.expectedResults,
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
Generated
-9
@@ -63,9 +63,6 @@ importers:
|
||||
broccoli-source:
|
||||
specifier: ^3.0.1
|
||||
version: 3.0.1
|
||||
dexie:
|
||||
specifier: ^3.2.4
|
||||
version: 3.2.7
|
||||
ember-auto-import:
|
||||
specifier: ^2.10.0
|
||||
version: 2.10.0(@glint/template@1.5.2)(webpack@5.99.8(esbuild@0.25.9))
|
||||
@@ -4491,10 +4488,6 @@ packages:
|
||||
detect-node@2.1.0:
|
||||
resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==}
|
||||
|
||||
dexie@3.2.7:
|
||||
resolution: {integrity: sha512-2a+BXvVhY5op+smDRLxeBAivE7YcYaneXJ1la3HOkUfX9zKkE/AJ8CNgjiXbtXepFyFmJNGSbmjOwqbT749r/w==}
|
||||
engines: {node: '>=6.0'}
|
||||
|
||||
dezalgo@1.0.3:
|
||||
resolution: {integrity: sha512-K7i4zNfT2kgQz3GylDw40ot9GAE47sFZ9EXHFSPP6zONLgH6kWXE0KWJchkbQJLBkRazq4APwZ4OwiFFlT95OQ==}
|
||||
|
||||
@@ -13381,8 +13374,6 @@ snapshots:
|
||||
detect-node@2.1.0:
|
||||
optional: true
|
||||
|
||||
dexie@3.2.7: {}
|
||||
|
||||
dezalgo@1.0.3:
|
||||
dependencies:
|
||||
asap: 2.0.6
|
||||
|
||||
@@ -7,7 +7,7 @@ import Route from '@ember/routing/route';
|
||||
import { service } from '@ember/service';
|
||||
import { action } from '@ember/object';
|
||||
import { A } from '@ember/array';
|
||||
import { formatDbName } from 'api/services/indexed-db';
|
||||
import { formatDbName } from 'api/services/sqlite';
|
||||
|
||||
/**
|
||||
* Entry route for the application.
|
||||
@@ -21,7 +21,6 @@ export default class ApplicationRoute extends Route {
|
||||
@service intl;
|
||||
@service features;
|
||||
@service featureEdition;
|
||||
@service indexedDb;
|
||||
@service sqlite;
|
||||
@service('browser/window') window;
|
||||
|
||||
@@ -75,7 +74,6 @@ export default class ApplicationRoute extends Route {
|
||||
const hostUrl = this.window.location.host;
|
||||
if (userId && hostUrl) {
|
||||
await this.sqlite.setup(formatDbName(userId, hostUrl));
|
||||
await this.indexedDb.setup(formatDbName(userId, hostUrl));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ export default class ScopesScopeRolesRolePrincipalsRoute extends Route {
|
||||
},
|
||||
});
|
||||
// TODO: Refactor to directly use store service
|
||||
// and add managed-group to indexedDB.
|
||||
// and add managed-group to sqlite.
|
||||
const nestedManagedGroups = await Promise.all(
|
||||
authMethods.map(({ id: auth_method_id }) =>
|
||||
this.resourceFilterStore.queryBy(
|
||||
|
||||
@@ -5,10 +5,9 @@
|
||||
|
||||
import BaseSessionService from 'ember-simple-auth/services/session';
|
||||
import { service } from '@ember/service';
|
||||
import { formatDbName } from 'api/services/indexed-db';
|
||||
import { formatDbName } from 'api/services/sqlite';
|
||||
|
||||
export default class SessionService extends BaseSessionService {
|
||||
@service indexedDb;
|
||||
@service sqlite;
|
||||
@service('browser/window') window;
|
||||
|
||||
@@ -21,7 +20,6 @@ export default class SessionService extends BaseSessionService {
|
||||
const hostUrl = this.window.location?.host;
|
||||
if (userId && hostUrl) {
|
||||
await this.sqlite.setup(formatDbName(userId, hostUrl));
|
||||
await this.indexedDb.setup(formatDbName(userId, hostUrl));
|
||||
}
|
||||
|
||||
// We let ember-simple-auth handle transitioning back to the index after authentication.
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import {
|
||||
@@ -22,7 +21,6 @@ module('Acceptance | accounts | change password', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from './selectors';
|
||||
@@ -19,7 +18,6 @@ module('Acceptance | aliases | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let features;
|
||||
let getAliasCount;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { click, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
@@ -17,7 +16,6 @@ module('Acceptance | aliases | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let aliasCount;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL, waitFor, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -19,7 +18,6 @@ module('Acceptance | aliases | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let intl;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { click, currentURL, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
@@ -17,7 +16,6 @@ module('Acceptance | aliases | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { click, fillIn, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -17,7 +16,6 @@ module('Acceptance | aliases | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let aliasCount;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn, select } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -19,7 +18,6 @@ module('Acceptance | auth-methods | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let getAuthMethodsCount;
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -20,7 +19,6 @@ module('Acceptance | auth-methods | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let featuresService;
|
||||
let getAuthMethodCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, waitFor, fillIn, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { faker } from '@faker-js/faker';
|
||||
@@ -23,7 +22,6 @@ module('Acceptance | auth-methods | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import {
|
||||
@@ -23,7 +22,6 @@ module('Acceptance | auth-methods | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, fillIn, select, findAll } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -23,7 +22,6 @@ module('Acceptance | auth-methods | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -32,7 +31,6 @@ import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
module('Acceptance | authentication', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -19,7 +18,6 @@ module('Acceptance | credential-stores | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let featuresService;
|
||||
let getCredentialStoresCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -21,7 +20,6 @@ module(
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let getCredentialsCount;
|
||||
let getUsernamePasswordCredentialCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -21,7 +20,6 @@ module('Acceptance | credential-stores | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let getStaticCredentialStoresCount;
|
||||
let getVaultCredentialStoresCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { click, currentURL, fillIn, visit, waitFor } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { faker } from '@faker-js/faker';
|
||||
@@ -23,7 +22,6 @@ module('Acceptance | credential-stores | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { click, currentURL, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
@@ -17,7 +16,6 @@ module('Acceptance | credential-stores | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -19,7 +18,6 @@ module('Acceptance | credential-stores | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -7,14 +7,12 @@ import { module, test } from 'qunit';
|
||||
import { visit, getContext } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Acceptance | develop', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -18,7 +17,6 @@ module('Acceptance | groups | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let groupsCount;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { faker } from '@faker-js/faker';
|
||||
@@ -24,7 +23,6 @@ module('Acceptance | groups | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const SEARCH_INPUT_SELECTOR = '.search-filtering [type="search"]';
|
||||
const NO_RESULTS_MSG_SELECTOR = '[data-test-no-groups-results]';
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -18,7 +17,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | groups | members', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const instances = {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
@@ -15,7 +15,7 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | groups | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from './selectors';
|
||||
@@ -18,7 +17,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | host-catalogs | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -9,7 +9,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import {
|
||||
@@ -22,7 +21,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | host-catalogs | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let getHostCatalogCount;
|
||||
|
||||
@@ -9,7 +9,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import {
|
||||
TYPE_HOST_CATALOG_DYNAMIC,
|
||||
TYPE_HOST_CATALOG_PLUGIN_AWS,
|
||||
@@ -26,7 +25,6 @@ module('Acceptance | host-catalogs | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
|
||||
@@ -17,7 +16,6 @@ module('Acceptance | host-catalogs | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -10,7 +10,6 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import {
|
||||
TYPE_HOST_CATALOG_DYNAMIC,
|
||||
@@ -23,7 +22,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | host-catalogs | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const instances = {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -23,7 +22,6 @@ module('Acceptance | managed-groups | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let getManagedGroupCount;
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import {
|
||||
@@ -22,7 +21,6 @@ module('Acceptance | managed-groups | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | policies | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | policies | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | policies | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let features;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -18,7 +17,6 @@ module('Acceptance | roles | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let getRolesCount;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import {
|
||||
@@ -32,7 +31,6 @@ module('Acceptance | roles | global-scope', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let confirmService;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { GRANT_SCOPE_THIS } from 'api/models/role';
|
||||
@@ -28,7 +27,6 @@ module('Acceptance | roles | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as selectors from './selectors';
|
||||
@@ -30,7 +29,6 @@ module('Acceptance | roles | org-scope', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let confirmService;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { visit, currentURL, click, findAll } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as selectors from './selectors';
|
||||
@@ -19,7 +18,6 @@ module('Acceptance | roles | principals', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ module('Acceptance | roles | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const instances = {
|
||||
scopes: {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { click, currentURL, fillIn, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -18,7 +17,6 @@ module('Acceptance | scopes', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let getScopeCount;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -18,7 +17,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | scopes | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let getScopeCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { currentURL, visit, fillIn, waitFor, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -17,7 +16,6 @@ import { faker } from '@faker-js/faker';
|
||||
module('Acceptance | scopes | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const instances = {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from './selectors';
|
||||
@@ -16,7 +16,7 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | scopes | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let features;
|
||||
let featureEdition;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -16,7 +15,6 @@ import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
module('Acceptance | scopes | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let confirmService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn, waitFor } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -24,7 +23,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | session recordings | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -18,7 +17,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | session-recordings | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from '../../selectors';
|
||||
@@ -20,7 +20,7 @@ module(
|
||||
function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { click, currentURL, fillIn, visit, waitFor } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { faker } from '@faker-js/faker';
|
||||
@@ -27,7 +26,6 @@ module('Acceptance | sessions | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const CREATED_TIME_VALUES_ARRAY = [
|
||||
'2020-01-01T00:00:01.010Z',
|
||||
|
||||
@@ -8,7 +8,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | storage-buckets | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let intl;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as selectors from './selectors';
|
||||
@@ -17,7 +16,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | storage-buckets | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | storage-buckets | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let features;
|
||||
|
||||
@@ -9,7 +9,6 @@ import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -21,7 +20,6 @@ module('Acceptance | targets | create-alias', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let getAliasCount;
|
||||
|
||||
@@ -16,7 +16,6 @@ import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_TARGET_SSH, TYPE_TARGET_TCP } from 'api/models/target';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -27,7 +26,6 @@ module('Acceptance | targets | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let getTargetCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { click, currentURL, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -20,7 +19,6 @@ module('Acceptance | targets | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let getTargetCount;
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_TARGET_TCP, TYPE_TARGET_SSH } from 'api/models/target';
|
||||
@@ -28,7 +27,6 @@ module('Acceptance | targets | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
const NAME_VALUES_ARRAY = ['Alpha', 'Beta', 'Delta', 'Epsilon', 'Gamma'];
|
||||
const ID_VALUES_ARRAY = ['i_0001', 'i_0010', 'i_0100', 'i_1000', 'i_10000'];
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { click, currentURL, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -20,7 +19,6 @@ module('Acceptance | targets | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { click, currentURL, fillIn, visit } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { Response } from 'miragejs';
|
||||
@@ -20,7 +19,6 @@ module('Acceptance | targets | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -17,7 +16,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | users | create', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let getUsersCount;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -18,7 +17,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | users | delete', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let getUsersCount, confirmService;
|
||||
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
} from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -25,7 +24,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | users | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const instances = {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | users | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
const urls = {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click, fillIn } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { Response } from 'miragejs';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -17,7 +16,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | users | update', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let confirmService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, click, currentURL } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
import * as selectors from './selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | workers | list', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { visit, currentURL, click } from '@ember/test-helpers';
|
||||
import { setupApplicationTest } from 'admin/tests/helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import * as commonSelectors from 'admin/tests/helpers/selectors';
|
||||
@@ -16,7 +15,6 @@ import { setRunOptions } from 'ember-a11y-testing/test-support';
|
||||
module('Acceptance | workers | read', function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let featuresService;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { currentURL, waitUntil, visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_TARGET_TCP } from 'api/models/target';
|
||||
@@ -15,7 +14,6 @@ import { TYPE_TARGET_TCP } from 'api/models/target';
|
||||
module('Unit | Controller | onboarding/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let store;
|
||||
|
||||
@@ -7,14 +7,12 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { currentURL, waitUntil, visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Unit | Controller | onboarding/success', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let controller;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit, waitUntil } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -15,7 +14,6 @@ import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
module('Unit | Controller | scopes/scope/aliases/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { setupTest } from 'ember-qunit';
|
||||
import { waitUntil } from '@ember/test-helpers';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -22,7 +21,6 @@ module('Unit | Controller | scopes/scope/auth-methods/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_AUTH_METHOD_PASSWORD } from 'api/models/auth-method';
|
||||
@@ -17,7 +16,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let controller;
|
||||
|
||||
-2
@@ -8,7 +8,6 @@ import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_CREDENTIAL_STORE_VAULT } from 'api/models/credential-store';
|
||||
@@ -18,7 +17,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
-2
@@ -8,7 +8,6 @@ import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
import { TYPE_CREDENTIAL_STORE_STATIC } from 'api/models/credential-store';
|
||||
@@ -18,7 +17,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { waitUntil, visit } from '@ember/test-helpers';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -22,7 +21,6 @@ module(
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
@@ -8,7 +8,6 @@ import { setupTest } from 'ember-qunit';
|
||||
import { waitUntil, visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -16,7 +15,6 @@ module('Unit | Controller | scopes/scope/groups/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
-2
@@ -8,7 +8,6 @@ import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -17,7 +16,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import { setupTest } from 'ember-qunit';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { waitUntil, visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -17,7 +16,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Unit | Controller | scopes/scope/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let store;
|
||||
|
||||
@@ -8,13 +8,11 @@ import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
module('Unit | Controller | scopes/scope/policies/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { waitUntil, visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -16,7 +15,6 @@ module('Unit | Controller | scopes/scope/roles/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
-2
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit, currentURL, waitUntil } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -16,7 +15,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let store;
|
||||
|
||||
-2
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { currentURL, visit, waitUntil } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -16,7 +15,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
|
||||
let store;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit, waitUntil } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -21,7 +20,6 @@ import { TYPE_SCOPE_ORG, TYPE_SCOPE_PROJECT } from 'api/models/scope';
|
||||
module('Unit | Controller | scopes/scope/roles/role/scopes', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
|
||||
@@ -16,7 +15,6 @@ module(
|
||||
function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { visit, waitUntil } from '@ember/test-helpers';
|
||||
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
|
||||
import { setupIndexedDb } from 'api/test-support/helpers/indexed-db';
|
||||
import { setupSqlite } from 'api/test-support/helpers/sqlite';
|
||||
import { setupIntl } from 'ember-intl/test-support';
|
||||
import { authenticateSession } from 'ember-simple-auth/test-support';
|
||||
@@ -17,7 +16,6 @@ module('Unit | Controller | scopes/scope/targets/index', function (hooks) {
|
||||
setupTest(hooks);
|
||||
setupMirage(hooks);
|
||||
setupSqlite(hooks);
|
||||
setupIndexedDb(hooks);
|
||||
setupIntl(hooks, 'en-us');
|
||||
|
||||
let intl;
|
||||
|
||||
Loaded 100 of 101 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user