From cee3c5a423f5e943ded1cfa5ea626728ddc2577b Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Mon, 1 Jul 2024 11:24:07 -0400 Subject: [PATCH] git commit -m '21720: * removed redundant components dir * updated login-panel test * added test-cypress script for unit tests Arvados-DCO-1.1-Signed-off-by: Lisa Knox ' --- .../cypress/component/LoginPanel.cy.tsx | 10 --- services/workbench2/package.json | 1 + ...val.test.tsx => use-async-interval.cy.tsx} | 0 ...login-panel.test.tsx => login-panel.cy.js} | 67 ++++++++++--------- 4 files changed, 36 insertions(+), 42 deletions(-) delete mode 100644 services/workbench2/cypress/component/LoginPanel.cy.tsx rename services/workbench2/src/common/{use-async-interval.test.tsx => use-async-interval.cy.tsx} (100%) rename services/workbench2/src/views/login-panel/{login-panel.test.tsx => login-panel.cy.js} (88%) diff --git a/services/workbench2/cypress/component/LoginPanel.cy.tsx b/services/workbench2/cypress/component/LoginPanel.cy.tsx deleted file mode 100644 index 34faf95594..0000000000 --- a/services/workbench2/cypress/component/LoginPanel.cy.tsx +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (C) The Arvados Authors. All rights reserved. -// -// SPDX-License-Identifier: AGPL-3.0 - -describe('LoginPanel.cy.tsx', () => { - it('playground', () => { - const foo = 'foo'; - expect(foo).to.equal('foo'); - }) -}) \ No newline at end of file diff --git a/services/workbench2/package.json b/services/workbench2/package.json index f3ad30841c..ae3b379351 100644 --- a/services/workbench2/package.json +++ b/services/workbench2/package.json @@ -140,6 +140,7 @@ "build-local": "node scripts/build.js", "test": "CI=true node scripts/test.js", "test-local": "node scripts/test.js", + "test-cypress": " yarn cypress run --component", "lint": "tslint src/** -t verbose", "build-css": "node-sass src/ -o src/", "watch-css": "npm run build-css && node-sass src/ -o src/ --watch --recursive" diff --git a/services/workbench2/src/common/use-async-interval.test.tsx b/services/workbench2/src/common/use-async-interval.cy.tsx similarity index 100% rename from services/workbench2/src/common/use-async-interval.test.tsx rename to services/workbench2/src/common/use-async-interval.cy.tsx diff --git a/services/workbench2/src/views/login-panel/login-panel.test.tsx b/services/workbench2/src/views/login-panel/login-panel.cy.js similarity index 88% rename from services/workbench2/src/views/login-panel/login-panel.test.tsx rename to services/workbench2/src/views/login-panel/login-panel.cy.js index b490acd93c..5f9d68fe5d 100644 --- a/services/workbench2/src/views/login-panel/login-panel.test.tsx +++ b/services/workbench2/src/views/login-panel/login-panel.cy.js @@ -9,38 +9,39 @@ describe('', () => { it('should return false if no config specified', () => { // given const config = null; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeFalsy(); + expect(!!result).to.equal(false); }); - + it('should return false if no config.clusterConfig specified', () => { // given const config = {}; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeFalsy(); + expect(!!result).to.equal(false); + }); - + it('should return false if no config.clusterConfig.Login specified', () => { // given const config = { clusterConfig: {}, }; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeFalsy(); + expect(!!result).to.equal(false); }); - + it('should return false if no config.clusterConfig.Login.LDAP and config.clusterConfig.Login.PAM specified', () => { // given const config = { @@ -48,14 +49,14 @@ describe('', () => { Login: {} }, }; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeFalsy(); + expect(!!result).to.equal(false); }); - + it('should return false if config.clusterConfig.Login.LDAP.Enable and config.clusterConfig.Login.PAM.Enable not specified', () => { // given const config = { @@ -66,14 +67,14 @@ describe('', () => { }, }, }; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeFalsy(); + expect(!!result).to.equal(false); }); - + it('should return value from config.clusterConfig.Login.LDAP.Enable', () => { // given const config = { @@ -86,14 +87,14 @@ describe('', () => { }, }, }; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeTruthy(); + expect(!!result).to.equal(true); }); - + it('should return value from config.clusterConfig.Login.PAM.Enable', () => { // given const config = { @@ -106,14 +107,15 @@ describe('', () => { }, }, }; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeTruthy(); + expect(!!result).to.equal(true); + }); - + it('should return false for not specified config option config.clusterConfig.Login.NOT_EXISTING.Enable', () => { // given const config = { @@ -125,12 +127,13 @@ describe('', () => { }, }, }; - + // when const result = requirePasswordLogin(config); - + // then - expect(result).toBeFalsy(); + expect(!!result).to.equal(false); + }); }); -}); \ No newline at end of file + }); \ No newline at end of file -- 2.30.2