From f3f83ed10e09ce9b299e7f185d19d5007c8b13ae Mon Sep 17 00:00:00 2001 From: Mori Bellamy Date: Sun, 17 May 2020 16:57:18 -0700 Subject: [PATCH] more reorg --- src/app.ts | 4 ++-- src/app/ui.ts | 2 +- tests/archive.test.ts | 5 +++-- tests/grayTabby.test.ts | 5 +++-- tests/utils.ts | 10 +--------- 5 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/app.ts b/src/app.ts index 35f0159..5e54602 100644 --- a/src/app.ts +++ b/src/app.ts @@ -6,10 +6,10 @@ // Webpack uses MiniCssExtractPlugin when it sees this. import './scss/app.scss'; -import { grayTabby } from './app/ui'; +import { graytabby } from './app/ui'; import { PAGE_LOAD } from './lib/globals'; -grayTabby().then( +graytabby().then( () => { PAGE_LOAD.get() .pub() diff --git a/src/app/ui.ts b/src/app/ui.ts index cfe34b0..d28cac7 100644 --- a/src/app/ui.ts +++ b/src/app/ui.ts @@ -279,7 +279,7 @@ declare global { /** * The main entry point for GrayTabby. */ -export async function grayTabby(): Promise { +export async function graytabby(): Promise { DOCUMENT.get().title = 'GrayTabby'; await bindOptions(); const groupsNode = DOCUMENT.get().querySelector('#groups'); diff --git a/tests/archive.test.ts b/tests/archive.test.ts index bcf4b5d..66c65b6 100644 --- a/tests/archive.test.ts +++ b/tests/archive.test.ts @@ -4,8 +4,9 @@ import { archivePlan } from '../src/bg/archive'; import { Broker, BrokerConsumer } from '../src/lib/brokers'; import { ARCHIVAL, DOCUMENT } from '../src/lib/globals'; import { dateFromKey, INDEX_V2_KEY } from '../src/app/tabs'; -import { assertElement, initGrayTabby, testTab, stubGlobals, unstubGlobals } from './utils'; +import { assertElement, testTab, stubGlobals, unstubGlobals } from './utils'; import { BrowserTab } from '../src/lib/types'; +import { graytabby } from '../src/app/ui'; describe('archive operation', function() { beforeEach(async function() { @@ -25,7 +26,7 @@ describe('archive operation', function() { consumer = func; }; ARCHIVAL.set(archival); - await initGrayTabby(); + await graytabby(); assertElement('#groups > div', DOCUMENT.get(), 0); consumer([testTab({ url: 'http://example.com' })], {}, () => null); diff --git a/tests/grayTabby.test.ts b/tests/grayTabby.test.ts index 0b73fc5..eb569a2 100644 --- a/tests/grayTabby.test.ts +++ b/tests/grayTabby.test.ts @@ -1,5 +1,6 @@ -import { initGrayTabby, stubGlobals, unstubGlobals } from './utils'; +import { stubGlobals, unstubGlobals } from './utils'; import { bindArchivalHandlers } from '../src/bg/archive'; +import { graytabby } from '../src/app/ui'; describe('graytabby', function() { beforeEach(async function() { @@ -11,7 +12,7 @@ describe('graytabby', function() { }); it('frontend should attach to dom without throwing', async () => { - await initGrayTabby(); + await graytabby(); }); it('backend should register handlers without throwing', async () => { diff --git a/tests/utils.ts b/tests/utils.ts index 9eb775e..4d61536 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { JSDOM } from 'jsdom'; import * as mockBrowser from 'sinon-chrome'; import { INDEX_V1_KEY, INDEX_V2_KEY } from '../src/app/tabs'; -import { grayTabby } from '../src/app/ui'; +import { graytabby } from '../src/app/ui'; import { BROWSER, DOCUMENT } from '../src/lib/globals'; import { OPTIONS_KEY } from '../src/lib/options'; import { BrowserTab } from '../src/lib/types'; @@ -22,14 +22,6 @@ export function unstubGlobals(): void { DOCUMENT.set(null); } -export async function initGrayTabby(): Promise { - try { - return await grayTabby(); - } catch (err) { - expect.fail('Uncaught error: ' + err); - } -} - export function testTab(args: Partial): BrowserTab { return { index: 1,