From 46c8accd848160fa5b7fb7393ddacf05d6b2b5e8 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 18 Mar 2024 16:32:23 +0000 Subject: [PATCH] =?UTF-8?q?chore:=20cloudcmd:=20actions:=20lint=20?= =?UTF-8?q?=E2=98=98=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/cloudcmd.spec.js | 60 ++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/server/cloudcmd.spec.js b/server/cloudcmd.spec.js index f2c6e1a7..d44047cc 100644 --- a/server/cloudcmd.spec.js +++ b/server/cloudcmd.spec.js @@ -21,13 +21,13 @@ const { test('cloudcmd: defaults: config', (t) => { const configManager = createConfigManager(); - + configManager('configDialog', false); - + cloudcmd({ configManager, }); - + t.notOk(configManager('configDialog'), 'should not override config with defaults'); t.end(); }); @@ -35,11 +35,11 @@ test('cloudcmd: defaults: config', (t) => { test('cloudcmd: defaults: console', (t) => { const configManager = createConfigManager(); configManager('console', false); - + cloudcmd({ configManager, }); - + t.notOk(configManager('console'), 'should not override config with defaults'); t.end(); }); @@ -47,7 +47,7 @@ test('cloudcmd: defaults: console', (t) => { test('cloudcmd: getPrefix', (t) => { const value = 'hello'; const result = _getPrefix(value); - + t.equal(result, value); t.end(); }); @@ -56,7 +56,7 @@ test('cloudcmd: getPrefix: function', (t) => { const value = 'hello'; const fn = () => value; const result = _getPrefix(fn); - + t.equal(result, value); t.end(); }); @@ -65,34 +65,34 @@ test('cloudcmd: getPrefix: function: empty', (t) => { const value = null; const fn = () => value; const result = _getPrefix(fn); - + t.equal(result, ''); t.end(); }); test('cloudcmd: replaceDist', (t) => { const currentIsDev = _isDev(); - + _isDev(true); const url = '/dist/hello'; const result = _replaceDist(url); const expected = '/dist-dev/hello'; - + _isDev(currentIsDev); - + t.equal(result, expected); t.end(); }); test('cloudcmd: replaceDist: !isDev', (t) => { const url = '/dist/hello'; - + const currentIsDev = _isDev(); _isDev(false); const result = _replaceDist(url); - + _isDev(currentIsDev); - + t.equal(result, url); t.end(); }); @@ -100,18 +100,18 @@ test('cloudcmd: replaceDist: !isDev', (t) => { test('cloudcmd: auth: reject', (t) => { const accept = stub(); const reject = stub(); - + const config = createConfigManager(); - + const username = 'root'; const password = 'toor'; - + config('auth', true); config('username', username); config('password', password); - + _initAuth(config, accept, reject, username, 'abc'); - + t.ok(reject.called, 'should reject'); t.end(); }); @@ -119,18 +119,18 @@ test('cloudcmd: auth: reject', (t) => { test('cloudcmd: auth: accept', (t) => { const accept = stub(); const reject = stub(); - + const username = 'root'; const password = 'toor'; const auth = true; - + const config = createConfigManager(); config('username', username); config('password', password); config('auth', auth); - + _initAuth(config, accept, reject, username, password); - + t.ok(accept.called, 'should accept'); t.end(); }); @@ -138,18 +138,18 @@ test('cloudcmd: auth: accept', (t) => { test('cloudcmd: auth: accept: no auth', (t) => { const accept = stub(); const reject = stub(); - + const auth = false; const username = 'root'; const password = 'toor'; - + const config = createConfigManager(); config('username', username); config('password', password); config('auth', auth); - + _initAuth(config, accept, reject, username, password); - + t.ok(accept.called, 'should accept'); t.end(); }); @@ -157,7 +157,7 @@ test('cloudcmd: auth: accept: no auth', (t) => { test('cloudcmd: getIndexPath: production', (t) => { const isDev = false; const name = path.join(__dirname, '..', 'dist', 'index.html'); - + t.equal(cloudcmd._getIndexPath(isDev), name); t.end(); }); @@ -165,14 +165,14 @@ test('cloudcmd: getIndexPath: production', (t) => { test('cloudcmd: getIndexPath: development', (t) => { const isDev = true; const name = path.join(__dirname, '..', 'dist-dev', 'index.html'); - + t.equal(cloudcmd._getIndexPath(isDev), name); t.end(); }); test('cloudcmd: sw', async (t) => { const {status} = await request.get('/sw.js'); - + t.equal(status, 200, 'should return sw'); t.end(); });