chore: Fix lint errors and format
This commit is contained in:
29 files changed
+1226
-1029
No files matched your search
@@ -0,0 +1,7 @@
|
||||
files:
|
||||
include: 'app/styles/**/*.s+(a|c)ss'
|
||||
rules:
|
||||
leading-zero: 0
|
||||
mixins-before-declarations: 0
|
||||
nesting-depth: 0
|
||||
placeholder-in-extend: 0
|
||||
@@ -1,7 +1,7 @@
|
||||
import Application from '@ember/application';
|
||||
import Resolver from 'ember-resolver';
|
||||
import loadInitializers from 'ember-load-initializers';
|
||||
import config from './config/environment';
|
||||
import Application from "@ember/application";
|
||||
import Resolver from "ember-resolver";
|
||||
import loadInitializers from "ember-load-initializers";
|
||||
import config from "./config/environment";
|
||||
|
||||
export default class App extends Application {
|
||||
modulePrefix = config.modulePrefix;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { helper } from '@ember/component/helper';
|
||||
import config from '../config/environment';
|
||||
import { helper } from "@ember/component/helper";
|
||||
import config from "../config/environment";
|
||||
|
||||
export default helper(function appName() {
|
||||
return config.appName;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import EmberRouter from '@ember/routing/router';
|
||||
import config from './config/environment';
|
||||
import EmberRouter from "@ember/routing/router";
|
||||
import config from "./config/environment";
|
||||
|
||||
export default class Router extends EmberRouter {
|
||||
location = config.locationType;
|
||||
@@ -7,9 +7,9 @@ export default class Router extends EmberRouter {
|
||||
}
|
||||
|
||||
Router.map(function () {
|
||||
this.route('scopes', function() {
|
||||
this.route('scope', { path: ':scope_id' }, function() {
|
||||
this.route('targets', function() {});
|
||||
this.route("scopes", function () {
|
||||
this.route("scope", { path: ":scope_id" }, function () {
|
||||
this.route("targets", function () {});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default class IndexRoute extends Route {
|
||||
// =services
|
||||
@@ -13,8 +13,8 @@ export default class IndexRoute extends Route {
|
||||
* @return {Promise}
|
||||
*/
|
||||
model() {
|
||||
return this.ipc.invoke('getFoobars', {
|
||||
id: '1'
|
||||
return this.ipc.invoke("getFoobars", {
|
||||
id: "1",
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,6 +22,6 @@ export default class IndexRoute extends Route {
|
||||
* Redirects to scopes route for further processing.
|
||||
*/
|
||||
redirect() {
|
||||
this.transitionTo('scopes');
|
||||
this.transitionTo("scopes");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { A } from '@ember/array';
|
||||
import Route from "@ember/routing/route";
|
||||
import { A } from "@ember/array";
|
||||
|
||||
export default class ScopesRoute extends Route {
|
||||
// =methods
|
||||
@@ -16,6 +16,6 @@ export default class ScopesRoute extends Route {
|
||||
model() {
|
||||
// NOTE: In the absence of a `scope_id` query parameter, this endpoint is
|
||||
// expected to default to the global scope, thus returning org scopes.
|
||||
return this.store.findAll('scope').catch(() => A([]));
|
||||
return this.store.findAll("scope").catch(() => A([]));
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { A } from '@ember/array';
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { A } from "@ember/array";
|
||||
|
||||
export default class ScopesScopeRoute extends Route {
|
||||
// =services
|
||||
@@ -22,19 +22,18 @@ export default class ScopesScopeRoute extends Route {
|
||||
model({ scope_id: id }) {
|
||||
// Since only global and org scopes are authenticatable, we can infer type
|
||||
// from ID because global has a fixed ID.
|
||||
const type = id === 'global' ? 'global' : 'org';
|
||||
return this.store.findRecord('scope', id).catch(() => {
|
||||
console.error('caught error');
|
||||
const maybeExistingScope = this.store.peekRecord('scope', id);
|
||||
const type = id === "global" ? "global" : "org";
|
||||
return this.store.findRecord("scope", id).catch(() => {
|
||||
console.error("caught error");
|
||||
const maybeExistingScope = this.store.peekRecord("scope", id);
|
||||
|
||||
const scopeOptions = { id, type };
|
||||
return (
|
||||
maybeExistingScope || this.store.createRecord('scope', scopeOptions)
|
||||
maybeExistingScope || this.store.createRecord("scope", scopeOptions)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load all scopes within the current scope context. Always attempt to load
|
||||
* org scopes. Only attempt to load project scopes if the current scope is
|
||||
@@ -43,18 +42,19 @@ export default class ScopesScopeRoute extends Route {
|
||||
async afterModel(model) {
|
||||
// Load all orgs
|
||||
let orgs;
|
||||
orgs = await this.store.query('scope', { scope_id: 'global' })
|
||||
orgs = await this.store
|
||||
.query("scope", { scope_id: "global" })
|
||||
.catch(() => A([]));
|
||||
// Then pull out the "selected" scopes, if relevant
|
||||
let selectedOrg;
|
||||
if (model.isGlobal || model.isOrg) selectedOrg = model;
|
||||
|
||||
let projects;
|
||||
if(model.isGlobal) {
|
||||
projects = orgs.map((id) => this.store.query('scope', { scope_id: id }));
|
||||
if (model.isGlobal) {
|
||||
projects = orgs.map((id) => this.store.query("scope", { scope_id: id }));
|
||||
}
|
||||
if(model.isOrg) {
|
||||
projects = this.store.query('scope', { scope_id: model.id });
|
||||
if (model.isOrg) {
|
||||
projects = this.store.query("scope", { scope_id: model.id });
|
||||
}
|
||||
|
||||
// Update the scope service with the current scope(s);
|
||||
@@ -81,9 +81,9 @@ export default class ScopesScopeRoute extends Route {
|
||||
*/
|
||||
renderTemplate() {
|
||||
super.renderTemplate(...arguments);
|
||||
this.render('scopes/scope/-header-nav', {
|
||||
into: 'application',
|
||||
outlet: 'header-nav',
|
||||
this.render("scopes/scope/-header-nav", {
|
||||
into: "application",
|
||||
outlet: "header-nav",
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import Route from "@ember/routing/route";
|
||||
|
||||
export default class ScopesScopeIndexRoute extends Route {
|
||||
// =methods
|
||||
@@ -7,6 +7,6 @@ export default class ScopesScopeIndexRoute extends Route {
|
||||
* Redirects to scopes route for further processing.
|
||||
*/
|
||||
redirect() {
|
||||
this.transitionTo('scopes.scope.targets');
|
||||
this.transitionTo("scopes.scope.targets");
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import { all } from 'rsvp';
|
||||
import { inject as service } from '@ember/service';
|
||||
import Route from "@ember/routing/route";
|
||||
import { all } from "rsvp";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default class ScopesScopeTargetsRoute extends Route {
|
||||
// =services
|
||||
@@ -14,16 +14,17 @@ export default class ScopesScopeTargetsRoute extends Route {
|
||||
* @return {Promise{[TargetModel]}}
|
||||
*/
|
||||
async model() {
|
||||
let projectTargets = await all(this.scope.projects.map(({ id: scope_id }) =>
|
||||
this.store.query('target', { scope_id })
|
||||
))
|
||||
let projectTargets = await all(
|
||||
this.scope.projects.map(({ id: scope_id }) =>
|
||||
this.store.query("target", { scope_id })
|
||||
)
|
||||
);
|
||||
let targets = projectTargets.map((target) => target.toArray()).flat();
|
||||
return targets.map((target) => {
|
||||
return {
|
||||
target,
|
||||
project: this.store.peekRecord('scope', target.scopeID),
|
||||
}
|
||||
})
|
||||
project: this.store.peekRecord("scope", target.scopeID),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import Route from '@ember/routing/route';
|
||||
import Route from "@ember/routing/route";
|
||||
|
||||
export default class ScopesScopeTargetsIndexRoute extends Route {
|
||||
}
|
||||
export default class ScopesScopeTargetsIndexRoute extends Route {}
|
||||
@@ -1,7 +1,7 @@
|
||||
import Service from '@ember/service';
|
||||
import { getOwner } from '@ember/application';
|
||||
import { Promise } from 'rsvp';
|
||||
import config from '../config/environment';
|
||||
import Service from "@ember/service";
|
||||
import { getOwner } from "@ember/application";
|
||||
import { Promise } from "rsvp";
|
||||
import config from "../config/environment";
|
||||
|
||||
/**
|
||||
* An IPC request is a promise-like object that issues a request via
|
||||
@@ -31,7 +31,6 @@ import config from '../config/environment';
|
||||
*
|
||||
*/
|
||||
export class IPCRequest {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
@@ -57,21 +56,25 @@ export class IPCRequest {
|
||||
* @param {Window} window - A reference to the window object
|
||||
* @param {?string} origin
|
||||
*/
|
||||
constructor(method, payload, window, origin=config.ipc.defaultOrigin) {
|
||||
constructor(method, payload, window, origin = config.ipc.defaultOrigin) {
|
||||
this.method = method;
|
||||
this.payload = payload;
|
||||
this.origin = origin;
|
||||
this.#channel = new MessageChannel();
|
||||
this.#promise = new Promise((resolve/*, reject*/) => {
|
||||
this.#promise = new Promise((resolve /*, reject*/) => {
|
||||
this.#channel.port1.onmessage = (event) => {
|
||||
this.close();
|
||||
resolve(event.data);
|
||||
}
|
||||
};
|
||||
});
|
||||
window.postMessage({
|
||||
method: this.method,
|
||||
payload: this.payload
|
||||
}, origin, [ this.#channel.port2 ]);
|
||||
window.postMessage(
|
||||
{
|
||||
method: this.method,
|
||||
payload: this.payload,
|
||||
},
|
||||
origin,
|
||||
[this.#channel.port2]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,7 +107,6 @@ export class IPCRequest {
|
||||
finally() {
|
||||
return this.#promise.finally(...arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +122,6 @@ export class IPCRequest {
|
||||
* }
|
||||
*/
|
||||
export default class IpcService extends Service {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
@@ -129,7 +130,7 @@ export default class IpcService extends Service {
|
||||
*/
|
||||
get window() {
|
||||
// The Ember way of accessing globals...
|
||||
const document = getOwner(this).lookup('service:-document').documentElement;
|
||||
const document = getOwner(this).lookup("service:-document").documentElement;
|
||||
// defaultView === window, but without using globals directly
|
||||
return document.parentNode.defaultView;
|
||||
}
|
||||
@@ -146,5 +147,4 @@ export default class IpcService extends Service {
|
||||
invoke(method, payload, origin) {
|
||||
return new IPCRequest(method, payload, this.window, origin);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
import Service from '@ember/service';
|
||||
import { tracked } from '@glimmer/tracking';
|
||||
import Service from "@ember/service";
|
||||
import { tracked } from "@glimmer/tracking";
|
||||
|
||||
/**
|
||||
* This simple non-functional service is used to retain references to
|
||||
* the currently active scope or scopes.
|
||||
*/
|
||||
export default class ScopeService extends Service {
|
||||
|
||||
// =attributes
|
||||
|
||||
/**
|
||||
@@ -14,7 +13,7 @@ export default class ScopeService extends Service {
|
||||
*/
|
||||
@tracked org;
|
||||
|
||||
/**
|
||||
/**
|
||||
* @type {[ScopeModel]}
|
||||
*/
|
||||
@tracked projects;
|
||||
|
||||
@@ -1 +1 @@
|
||||
@import 'rose';
|
||||
@import "rose";
|
||||
@@ -1,14 +1,26 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const APP_NAME = process.env.APP_NAME || 'Boundary';
|
||||
const API_HOST = process.env.API_HOST || '';
|
||||
const APP_NAME = process.env.APP_NAME || "Boundary";
|
||||
const API_HOST = process.env.API_HOST || "";
|
||||
|
||||
module.exports = function (environment) {
|
||||
let ENV = {
|
||||
modulePrefix: 'desktop',
|
||||
modulePrefix: "desktop",
|
||||
environment,
|
||||
rootURL: process.env.EMBER_CLI_ELECTRON ? '' : process.env.EMBER_CLI_ELECTRON ? '' : process.env.EMBER_CLI_ELECTRON ? '' : '/',
|
||||
locationType: process.env.EMBER_CLI_ELECTRON ? 'hash' : process.env.EMBER_CLI_ELECTRON ? 'hash' : process.env.EMBER_CLI_ELECTRON ? 'hash' : 'auto',
|
||||
rootURL: process.env.EMBER_CLI_ELECTRON
|
||||
? ""
|
||||
: process.env.EMBER_CLI_ELECTRON
|
||||
? ""
|
||||
: process.env.EMBER_CLI_ELECTRON
|
||||
? ""
|
||||
: "/",
|
||||
locationType: process.env.EMBER_CLI_ELECTRON
|
||||
? "hash"
|
||||
: process.env.EMBER_CLI_ELECTRON
|
||||
? "hash"
|
||||
: process.env.EMBER_CLI_ELECTRON
|
||||
? "hash"
|
||||
: "auto",
|
||||
EmberENV: {
|
||||
FEATURES: {
|
||||
// Here you can enable experimental features on an ember canary build
|
||||
@@ -28,19 +40,19 @@ module.exports = function (environment) {
|
||||
|
||||
api: {
|
||||
host: API_HOST,
|
||||
namespace: 'v1',
|
||||
namespace: "v1",
|
||||
},
|
||||
|
||||
ipc: {
|
||||
defaultOrigin: process.env.EMBER_CLI_ELECTRON
|
||||
? 'serve://boundary'
|
||||
: 'http://localhost:4200'
|
||||
? "serve://boundary"
|
||||
: "http://localhost:4200",
|
||||
},
|
||||
|
||||
appName: APP_NAME,
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
if (environment === "development") {
|
||||
// ENV.APP.LOG_RESOLVER = true;
|
||||
// ENV.APP.LOG_ACTIVE_GENERATION = true;
|
||||
// ENV.APP.LOG_TRANSITIONS = true;
|
||||
@@ -48,19 +60,19 @@ module.exports = function (environment) {
|
||||
// ENV.APP.LOG_VIEW_LOOKUPS = true;
|
||||
}
|
||||
|
||||
if (environment === 'test') {
|
||||
if (environment === "test") {
|
||||
// Testem prefers this...
|
||||
ENV.locationType = 'none';
|
||||
ENV.locationType = "none";
|
||||
|
||||
// keep test console output quieter
|
||||
ENV.APP.LOG_ACTIVE_GENERATION = false;
|
||||
ENV.APP.LOG_VIEW_LOOKUPS = false;
|
||||
|
||||
ENV.APP.rootElement = '#ember-testing';
|
||||
ENV.APP.rootElement = "#ember-testing";
|
||||
ENV.APP.autoboot = false;
|
||||
}
|
||||
|
||||
if (environment === 'production') {
|
||||
if (environment === "production") {
|
||||
// here you can enable a production-specific feature
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const browsers = [
|
||||
'last 1 Chrome versions',
|
||||
'last 1 Firefox versions',
|
||||
'last 1 Safari versions'
|
||||
"last 1 Chrome versions",
|
||||
"last 1 Firefox versions",
|
||||
"last 1 Safari versions",
|
||||
];
|
||||
|
||||
const isCI = Boolean(process.env.CI);
|
||||
const isProduction = process.env.EMBER_ENV === 'production';
|
||||
const isProduction = process.env.EMBER_ENV === "production";
|
||||
|
||||
if (isCI || isProduction) {
|
||||
browsers.push('ie 11');
|
||||
browsers.push("ie 11");
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
browsers
|
||||
browsers,
|
||||
};
|
||||
@@ -1,19 +1,19 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const EmberApp = require('ember-cli/lib/broccoli/ember-app');
|
||||
const EmberApp = require("ember-cli/lib/broccoli/ember-app");
|
||||
|
||||
module.exports = function(defaults) {
|
||||
module.exports = function (defaults) {
|
||||
let app = new EmberApp(defaults, {
|
||||
babel: {
|
||||
sourceMaps: 'inline',
|
||||
sourceMaps: "inline",
|
||||
},
|
||||
sourcemaps: {
|
||||
enabled: true,
|
||||
extensions: ['js'],
|
||||
extensions: ["js"],
|
||||
},
|
||||
sassOptions: {
|
||||
onlyIncluded: true,
|
||||
extension: 'scss',
|
||||
extension: "scss",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"ember-qunit": "^4.6.0",
|
||||
"ember-resolver": "^8.0.0",
|
||||
"ember-source": "~3.20.2",
|
||||
"ember-template-lint": "^2.9.1",
|
||||
"ember-template-lint": "^2.14.0",
|
||||
"ember-welcome-page": "^4.0.0",
|
||||
"eslint": "^7.5.0",
|
||||
"eslint-plugin-ember": "^8.9.1",
|
||||
@@ -86,5 +86,8 @@
|
||||
},
|
||||
"ember": {
|
||||
"edition": "octane"
|
||||
},
|
||||
"dependencies": {
|
||||
"sass-lint": "^1.13.1"
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,25 @@
|
||||
module.exports = {
|
||||
test_page: 'tests/index.html?hidepassed',
|
||||
test_page: "tests/index.html?hidepassed",
|
||||
disable_watching: true,
|
||||
launchers: {
|
||||
Electron: require('ember-electron/lib/test-runner'),
|
||||
Electron: require("ember-electron/lib/test-runner"),
|
||||
},
|
||||
launch_in_ci: [
|
||||
'Electron',
|
||||
],
|
||||
launch_in_dev: [
|
||||
'Electron',
|
||||
],
|
||||
launch_in_ci: ["Electron"],
|
||||
launch_in_dev: ["Electron"],
|
||||
browser_args: {
|
||||
Electron: {
|
||||
// Note: Some these Chrome options may not be supported in Electron
|
||||
// See https://electronjs.org/docs/api/chrome-command-line-switches
|
||||
ci: [
|
||||
// --no-sandbox is needed when running Chrome inside a container
|
||||
process.env.CI ? '--no-sandbox' : null,
|
||||
'--headless',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-software-rasterizer',
|
||||
'--mute-audio',
|
||||
'--remote-debugging-port=0',
|
||||
'--window-size=1440,900'
|
||||
].filter(Boolean)
|
||||
}
|
||||
}
|
||||
process.env.CI ? "--no-sandbox" : null,
|
||||
"--headless",
|
||||
"--disable-dev-shm-usage",
|
||||
"--disable-software-rasterizer",
|
||||
"--mute-audio",
|
||||
"--remote-debugging-port=0",
|
||||
"--window-size=1440,900",
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
};
|
||||
+14
-18
@@ -1,27 +1,23 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
test_page: 'tests/index.html?hidepassed',
|
||||
test_page: "tests/index.html?hidepassed",
|
||||
disable_watching: true,
|
||||
launch_in_ci: [
|
||||
'Chrome'
|
||||
],
|
||||
launch_in_dev: [
|
||||
'Chrome'
|
||||
],
|
||||
launch_in_ci: ["Chrome"],
|
||||
launch_in_dev: ["Chrome"],
|
||||
browser_start_timeout: 120,
|
||||
browser_args: {
|
||||
Chrome: {
|
||||
ci: [
|
||||
// --no-sandbox is needed when running Chrome inside a container
|
||||
process.env.CI ? '--no-sandbox' : null,
|
||||
'--headless',
|
||||
'--disable-dev-shm-usage',
|
||||
'--disable-software-rasterizer',
|
||||
'--mute-audio',
|
||||
'--remote-debugging-port=0',
|
||||
'--window-size=1440,900'
|
||||
].filter(Boolean)
|
||||
}
|
||||
}
|
||||
process.env.CI ? "--no-sandbox" : null,
|
||||
"--headless",
|
||||
"--disable-dev-shm-usage",
|
||||
"--disable-software-rasterizer",
|
||||
"--mute-audio",
|
||||
"--remote-debugging-port=0",
|
||||
"--window-size=1440,900",
|
||||
].filter(Boolean),
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import Application from '../app';
|
||||
import config from '../config/environment';
|
||||
import { setApplication } from '@ember/test-helpers';
|
||||
import { start } from 'ember-qunit';
|
||||
import Application from "../app";
|
||||
import config from "../config/environment";
|
||||
import { setApplication } from "@ember/test-helpers";
|
||||
import { start } from "ember-qunit";
|
||||
|
||||
setApplication(Application.create(config.APP));
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Route | index', function(hooks) {
|
||||
module("Unit | Route | index", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:index');
|
||||
test("it exists", function (assert) {
|
||||
let route = this.owner.lookup("route:index");
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Route | scopes', function(hooks) {
|
||||
module("Unit | Route | scopes", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes');
|
||||
test("it exists", function (assert) {
|
||||
let route = this.owner.lookup("route:scopes");
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Route | scopes/scope', function(hooks) {
|
||||
module("Unit | Route | scopes/scope", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope');
|
||||
test("it exists", function (assert) {
|
||||
let route = this.owner.lookup("route:scopes/scope");
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Route | scopes/scope/index', function(hooks) {
|
||||
module("Unit | Route | scopes/scope/index", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/index');
|
||||
test("it exists", function (assert) {
|
||||
let route = this.owner.lookup("route:scopes/scope/index");
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Route | scopes/scope/targets', function(hooks) {
|
||||
module("Unit | Route | scopes/scope/targets", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/targets');
|
||||
test("it exists", function (assert) {
|
||||
let route = this.owner.lookup("route:scopes/scope/targets");
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Route | scopes/scope/targets/index', function(hooks) {
|
||||
module("Unit | Route | scopes/scope/targets/index", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function(assert) {
|
||||
let route = this.owner.lookup('route:scopes/scope/targets/index');
|
||||
test("it exists", function (assert) {
|
||||
let route = this.owner.lookup("route:scopes/scope/targets/index");
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
@@ -1,57 +1,56 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { IPCRequest } from 'desktop/services/ipc';
|
||||
import sinon from 'sinon';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
import { IPCRequest } from "desktop/services/ipc";
|
||||
import sinon from "sinon";
|
||||
|
||||
module('Unit | Service | ipc', function(hooks) {
|
||||
module("Unit | Service | ipc", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
hooks.beforeEach(() => {
|
||||
// IPC requests talk to the main process indirectly via window.postMessage
|
||||
// proxy layer (mediated by preload.js).
|
||||
// But we don't want to send these for real in tests.
|
||||
sinon.stub(window, 'postMessage');
|
||||
sinon.stub(window, "postMessage");
|
||||
});
|
||||
|
||||
hooks.afterEach(() => {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
test('it creates new IPCRequest objects', function(assert) {
|
||||
test("it creates new IPCRequest objects", function (assert) {
|
||||
assert.expect(1);
|
||||
const service = this.owner.lookup('service:ipc');
|
||||
const request = service.invoke('hello', 'world', 'http://localhost:4200');
|
||||
const service = this.owner.lookup("service:ipc");
|
||||
const request = service.invoke("hello", "world", "http://localhost:4200");
|
||||
assert.equal(request.constructor, IPCRequest);
|
||||
});
|
||||
|
||||
test('IPCRequest objects post messages on their window objects', function(assert) {
|
||||
test("IPCRequest objects post messages on their window objects", function (assert) {
|
||||
assert.expect(2);
|
||||
const myWindow = {
|
||||
postMessage(request) {
|
||||
assert.equal(request.method, 'hello');
|
||||
assert.equal(request.payload, 'world');
|
||||
}
|
||||
assert.equal(request.method, "hello");
|
||||
assert.equal(request.payload, "world");
|
||||
},
|
||||
};
|
||||
const request = new IPCRequest('hello', 'world', myWindow);
|
||||
new IPCRequest("hello", "world", myWindow);
|
||||
});
|
||||
|
||||
test('IPCRequest objects resolve to the value posted via a response message port', async function(assert) {
|
||||
test("IPCRequest objects resolve to the value posted via a response message port", async function (assert) {
|
||||
assert.expect(1);
|
||||
const myWindow = {
|
||||
postMessage(request, origin, [ port ]) {
|
||||
postMessage(request, origin, [port]) {
|
||||
// Post back a message on the response port
|
||||
port.postMessage({
|
||||
foo: 'bar',
|
||||
test: 42
|
||||
foo: "bar",
|
||||
test: 42,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
const request = new IPCRequest('hello', 'world', myWindow);
|
||||
const request = new IPCRequest("hello", "world", myWindow);
|
||||
const response = await request;
|
||||
assert.deepEqual(response, {
|
||||
foo: 'bar',
|
||||
test: 42
|
||||
foo: "bar",
|
||||
test: 42,
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -1,12 +1,12 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from 'ember-qunit';
|
||||
import { module, test } from "qunit";
|
||||
import { setupTest } from "ember-qunit";
|
||||
|
||||
module('Unit | Service | scope', function(hooks) {
|
||||
module("Unit | Service | scope", function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
// TODO: Replace this with your real tests.
|
||||
test('it exists', function(assert) {
|
||||
let service = this.owner.lookup('service:scope');
|
||||
test("it exists", function (assert) {
|
||||
let service = this.owner.lookup("service:scope");
|
||||
assert.ok(service);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user