Fix up app.test.js; drop some unnecessary and chatty logs

This commit is contained in:
Dannon Baker
2023-02-14 07:59:24 -05:00
parent bfc33739d6
commit 35d0da9a19
3 changed files with 2 additions and 31 deletions
+1 -20
View File
@@ -1,9 +1,6 @@
import { getGalaxyInstance, setGalaxyInstance } from "app";
import sinon from "sinon";
import Backbone from "backbone";
import { getAppRoot } from "onload";
import galaxyOptions from "@tests/qunit/test-data/bootstrapped";
import serverdata from "@tests/qunit/test-data/fakeserver";
export function setupTestGalaxy(galaxyOptions_ = null) {
galaxyOptions_ = galaxyOptions_ || galaxyOptions;
@@ -19,22 +16,6 @@ export function setupTestGalaxy(galaxyOptions_ = null) {
describe("App base construction/initializiation defaults", () => {
beforeEach(() => {
setupTestGalaxy(galaxyOptions);
window.WAIT_FADE = 300;
window.fakeserver = sinon.fakeServer.create();
for (const route in serverdata) {
window.fakeserver.respondWith("GET", getAppRoot() + route, [
200,
{ "Content-Type": "application/json" },
serverdata[route].data,
]);
}
});
afterEach(() => {
if (window.fakeserver) {
window.fakeserver.restore();
delete window.fakeserver;
}
});
test("App base construction/initializiation defaults", function () {
@@ -55,7 +36,7 @@ describe("App base construction/initializiation defaults", () => {
test("App base extends from Backbone.Events", function () {
const app = getGalaxyInstance();
["on", "off", "trigger", "listenTo", "stopListening"].forEach(function (fn) {
expect(app.fn && typeof app[fn] === "function").toBeTruthy();
expect(Object.prototype.hasOwnProperty.call(app, fn) && typeof app[fn] === "function").toBeTruthy();
});
});
+1 -9
View File
@@ -38,18 +38,11 @@ GalaxyApp.prototype._init = function (options, bootstrapped) {
this.params = options.params || {};
this.session_csrf_token = options.session_csrf_token || null;
// at this point, either logging or not and namespaces are enabled - chat it up
console.debug("GalaxyApp.options: ", this.options);
console.debug("GalaxyApp.config: ", this.config);
this._initLocale();
console.debug("GalaxyApp.localize: ", this.localize);
this.config = options.config || {};
console.debug("GalaxyApp.config: ", this.config);
this._initUser(options.user || {});
console.debug("GalaxyApp.user: ", this.user);
_setUserLocale(this.user, this.config);
_getUserLocale();
@@ -113,8 +106,7 @@ GalaxyApp.prototype._patchGalaxy = function _patchGalaxy(patchWith) {
};
/** add the localize fn to this object and the window namespace (as '_l') */
GalaxyApp.prototype._initLocale = function _initLocale(options) {
console.debug("_initLocale:", options);
GalaxyApp.prototype._initLocale = function _initLocale() {
this.localize = localize;
// add to window as global shortened alias
// TODO: temporary - remove when can require for plugins
-2
View File
@@ -32,8 +32,6 @@ var User = Backbone.Model.extend(
* @param {Object} data Initial model data.
*/
initialize: function (data) {
console.log("User.initialize:", data);
this.on("loaded", function (model, resp) {
console.log(`${this} has loaded:`, model, resp);
});