Skip to content

Commit

Permalink
remove console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed Sep 27, 2024
1 parent c8a333c commit 8d46c81
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 0 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export default [{
},

rules: {
strict: ["error", "function"],

"no-console": ["error", {
allow: ["warn", "error"],
}],
Expand Down
2 changes: 2 additions & 0 deletions kbase-extension/static/kbase/js/api/auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
define(['bluebird', 'jquery', 'narrativeConfig'], (Promise, $, Config) => {
'use strict';

function factory(config) {
const url = config.url;
const secureCookies =
Expand Down
2 changes: 2 additions & 0 deletions kbase-extension/static/kbase/js/narrativeLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ define([
'userMenu',
'util/bootstrapDialog',
], ($, Promise, kbapi, JupyterUtils, Config, Auth, UserMenu, BootstrapDialog) => {
'use strict';

const baseUrl = JupyterUtils.get_body_data('baseUrl');
const authClient = Auth.make({ url: Config.url('auth') });
let sessionInfo = null;
Expand Down
9 changes: 6 additions & 3 deletions test/unit/spec/api/authSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,9 @@ define(['api/auth', 'narrativeConfig', 'uuid', 'testUtil'], (Auth, Config, Uuid,
expect(authClient.getCookie(backupCookieName)).toEqual(backupCookieValue);
});

it('Should set and clear backup cookie in prod', () => {
it('Should set and clear backup cookie in prod', async () => {
const env = Config.get('environment');
const tokenCookie = 'kbase_session';
const backupCookieName = 'kbase_session_backup';
if (env !== 'prod') {
pending('This test is only valid for a prod config');
Expand All @@ -476,14 +477,16 @@ define(['api/auth', 'narrativeConfig', 'uuid', 'testUtil'], (Auth, Config, Uuid,

// Setting an arbitrary token should work.
const cookieValue = new Uuid(4).format();
authClient.setAuthToken(cookieValue);
mockAuthRequest('token', makeTokenInfo(), 200);
await authClient.setAuthToken(cookieValue);
expect(authClient.getAuthToken()).toEqual(cookieValue);
expect(authClient.getCookie(tokenCookie)).toEqual(cookieValue);
expect(authClient.getCookie(backupCookieName)).toEqual(cookieValue);

// Clearing an auth token should also work.
authClient.clearAuthToken();
expect(authClient.getAuthToken()).toBeNull();
expect(authClient.getCookie('kbase_session')).toBeNull();
expect(authClient.getCookie(tokenCookie)).toBeNull();
expect(authClient.getCookie(backupCookieName)).toBeNull();
});

Expand Down

0 comments on commit 8d46c81

Please sign in to comment.