-
+
diff --git a/frontend/src/result-list.js b/frontend/src/result-list.js
index 540f8930..32c24985 100644
--- a/frontend/src/result-list.js
+++ b/frontend/src/result-list.js
@@ -277,7 +277,7 @@ export class ResultList extends React.Component {
}
else if (operationMode === 'multi') {
// translate list to ;-separated string for BE
- value = this.state.inValues.map(item => item.trim()).join(";");
+ value = this.state.inValues.map(item => item.trim()).join(';');
}
else if (operationMode === 'bool') {
value = this.state.boolSelection;
@@ -580,7 +580,7 @@ export class ResultList extends React.Component {
placeholder="Select a result"
ref={toggleRef}
>
- {resultSelection ? resultSelection : "Select a result"}
+ {resultSelection ? resultSelection : 'Select a result'}
)
const resultMultiToggle = toggleRef => (
@@ -746,7 +746,7 @@ export class ResultList extends React.Component {
toggle={boolToggle}
>
- {["True", "False"].map((option, index) => (
+ {['True', 'False'].map((option, index) => (
{option}
@@ -755,10 +755,10 @@ export class ResultList extends React.Component {
}
{(filterMode === 'text' && operationMode === 'single') &&
- this.onTextChanged(newValue)} style={{height: "inherit"}}/>
+ this.onTextChanged(newValue)} style={{height: 'inherit'}}/>
}
{(filterMode === 'text' && operationMode === 'multi') &&
-
+
}
{(filterMode === 'run' && operationMode !== 'bool') &&
}
{(filterMode === 'text' && operationMode === 'single') &&
- this.onTextChanged(newValue)} style={{height: "inherit"}}/>
+ this.onTextChanged(newValue)} style={{height: 'inherit'}}/>
}
{(operationMode === 'multi') &&
-
+
}
];
@@ -583,7 +583,7 @@ export class RunList extends React.Component {
onApplyReport={this.applyReport}
onSetPage={this.setPage}
onSetPageSize={this.setPageSize}
- hideFilters={["project_id"]}
+ hideFilters={['project_id']}
/>
diff --git a/frontend/src/run.js b/frontend/src/run.js
index c16f70a1..5143f073 100644
--- a/frontend/src/run.js
+++ b/frontend/src/run.js
@@ -26,7 +26,6 @@ import {
Tabs,
TextContent,
Text,
- TextInput,
TreeView
} from '@patternfly/react-core';
import {
@@ -83,15 +82,11 @@ const MockRun = {
}
};
-const match = (node, text) => {
- return node.name.toLowerCase().indexOf(text.toLowerCase()) !== -1;
-};
+const match = (node, text) => node.name.toLowerCase().indexOf(text.toLowerCase()) !== -1;
-const findNode = (node, text) => {
- return match(node, text) || (
+const findNode = (node, text) => match(node, text) || (
node.children && node.children.length && !!node.children.find(child => findNode(child, text))
);
-};
const searchTree = (node, text) => {
if (match(node, text) || !node.children) {
@@ -362,9 +357,9 @@ export class Run extends React.Component {
.then(response => {
response = HttpClient.handleResponse(response, 'response');
if (response.ok) {
- this.setState({"isRunValid": true});
+ this.setState({'isRunValid': true});
} else {
- throw new Error("Failed with HTTP code " + response.status);
+ throw new Error('Failed with HTTP code ' + response.status);
}
return response.json();
})
@@ -528,7 +523,7 @@ export class Run extends React.Component {
}
{this.state.isRunValid &&
- }>
+ }>
@@ -722,7 +717,7 @@ export class Run extends React.Component {
- }>
+ }>
@@ -752,16 +747,10 @@ export class Run extends React.Component {
- }>
+ }>
- {false &&
-
- this.onSearch(value)} placeholder="Search tree..." aria-label="Filter tree" />
-
-
- }
{this.state.resultsTree.length === 0 &&
@@ -779,13 +768,11 @@ export class Run extends React.Component {
{this.state.testResult.test_id}
{this.state.testResult.metadata.markers &&
- {this.state.testResult.metadata.markers.map((marker) => {
- return {marker};
- })}
+ {this.state.testResult.metadata.markers.map((marker) => {marker})}
}
-
+
@@ -797,11 +784,11 @@ export class Run extends React.Component {
- }>
+ }>
{classificationTable}
{artifactTabs}
- }>
+ }>
true}/>
diff --git a/frontend/src/services/auth.js b/frontend/src/services/auth.js
index a7e74097..d83fcd75 100644
--- a/frontend/src/services/auth.js
+++ b/frontend/src/services/auth.js
@@ -38,7 +38,7 @@ export class AuthService {
user.token = token;
}
else {
- user = {"token": token};
+ user = {'token': token};
}
AuthService.setUser(user);
}
@@ -51,9 +51,7 @@ export class AuthService {
headers: {'Content-Type': 'application/json; charset=UTF-8'}
})
.then(response => response.json())
- .then(() => {
- return true;
- })
+ .then(() => true)
.catch(error => {
console.log(error);
AuthService.registerError = error;
@@ -147,8 +145,6 @@ export class AuthService {
}
})
.then(response => response.json())
- .then(json => {
- return json.is_superadmin;
- });
+ .then(json => json.is_superadmin);
}
}
diff --git a/frontend/src/services/context.js b/frontend/src/services/context.js
index b5153787..e856e17b 100644
--- a/frontend/src/services/context.js
+++ b/frontend/src/services/context.js
@@ -1,5 +1,4 @@
-import React from 'react';
-import {createContext, useState} from 'react';
+import React, {createContext, useState} from 'react';
import PropTypes from 'prop-types';
diff --git a/frontend/src/setupTests.js b/frontend/src/setupTests.js
new file mode 100644
index 00000000..f0afd0c2
--- /dev/null
+++ b/frontend/src/setupTests.js
@@ -0,0 +1,2 @@
+// src/setupTests.js
+import '../jest.polyfills.js';
diff --git a/frontend/src/sign-up.js b/frontend/src/sign-up.js
index 17e594e6..ae824aa2 100644
--- a/frontend/src/sign-up.js
+++ b/frontend/src/sign-up.js
@@ -41,7 +41,7 @@ class PasswordErrorBoundary extends React.Component {
}
componentDidCatch() {
- console.error("Failed to load password strength indicator");
+ console.error('Failed to load password strength indicator');
}
render() {
@@ -252,7 +252,7 @@ export class SignUp extends React.Component {
-
+
diff --git a/frontend/src/utilities.js b/frontend/src/utilities.js
index 82265aa6..55874c7d 100644
--- a/frontend/src/utilities.js
+++ b/frontend/src/utilities.js
@@ -206,7 +206,7 @@ export function resultToRow(result, filterFunc) {
classification = {result.metadata.classification.split('_')[0]};
}
return {
- "cells": [
+ 'cells': [
{title: {result.test_id} {markers}},
{title: runLink},
{title: {resultIcon} {toTitleCase(result.result)} {classification}},
@@ -244,9 +244,9 @@ export function resultToClassificationRow(result, index, filterFunc) {
return [
// parent row
{
- "isOpen": false,
- "result": result,
- "cells": [
+ 'isOpen': false,
+ 'result': result,
+ 'cells': [
{title: {result.test_id} {markers}},
{title: {resultIcon} {toTitleCase(result.result)}},
{title: {exceptionBadge}},
@@ -256,8 +256,8 @@ export function resultToClassificationRow(result, index, filterFunc) {
},
// child row (this is set in the onCollapse function for lazy-loading)
{
- "parent": 2*index,
- "cells": [{title: }]
+ 'parent': 2*index,
+ 'cells': [{title: }]
}
];
}
@@ -291,14 +291,14 @@ export function resultToComparisonRow(result, index) {
return [
// parent row
{
- "isOpen": false,
- "result": result,
- "cells": cells,
+ 'isOpen': false,
+ 'result': result,
+ 'cells': cells,
},
// child row (this is set in the onCollapse function for lazy-loading)
{
- "parent": 2*index,
- "cells": [{title: }]
+ 'parent': 2*index,
+ 'cells': [{title: }]
}
];
}
@@ -318,9 +318,9 @@ export function resultToTestHistoryRow(result, index, filterFunc) {
return [
// parent row
{
- "isOpen": false,
- "result": result,
- "cells": [
+ 'isOpen': false,
+ 'result': result,
+ 'cells': [
{title: {resultIcon} {toTitleCase(result.result)}},
{title: {result.source}},
{title: {exceptionBadge}},
@@ -330,8 +330,8 @@ export function resultToTestHistoryRow(result, index, filterFunc) {
},
// child row (this is set in the onCollapse function for lazy-loading)
{
- "parent": 2*index,
- "cells": [{title: }]
+ 'parent': 2*index,
+ 'cells': [{title: }]
}
];
}
diff --git a/frontend/src/views/accessibilityanalysis.js b/frontend/src/views/accessibilityanalysis.js
index 8ae3db91..bb3fd0fd 100644
--- a/frontend/src/views/accessibilityanalysis.js
+++ b/frontend/src/views/accessibilityanalysis.js
@@ -36,7 +36,6 @@ import {
getSpinnerRow,
resultToRow,
} from '../utilities';
-import { GenericAreaWidget } from '../widgets';
import { FilterTable, TabTitle } from '../components';
import { IbutsuContext } from '../services/context';
const MockRun = {
@@ -128,7 +127,7 @@ export class AccessibilityAnalysisView extends React.Component {
delete params['project'];
}
// probably don't need this, but maybe something similar
- params["run_list"] = this.state.filters.run_list?.val;
+ params['run_list'] = this.state.filters.run_list?.val;
HttpClient.get([Settings.serverUrl, 'widget', this.props.view.widget], params)
.then(response => HttpClient.handleResponse(response))
.then(data => {
@@ -185,7 +184,7 @@ export class AccessibilityAnalysisView extends React.Component {
if (contentType.includes('text')) {
response.text().then(text => {
artifactTabs.push(
- } style={{backgroundColor: "white"}}>
+ } style={{backgroundColor: 'white'}}>
@@ -203,7 +202,7 @@ export class AccessibilityAnalysisView extends React.Component {
response.blob().then(blob => {
let imageUrl = URL.createObjectURL(blob);
artifactTabs.push(
- } style={{backgroundColor: "white"}}>
+ } style={{backgroundColor: 'white'}}>
@@ -297,9 +296,9 @@ export class AccessibilityAnalysisView extends React.Component {
.then(response => {
response = HttpClient.handleResponse(response, 'response');
if (response.ok) {
- this.setState({"isRunValid": true});
+ this.setState({'isRunValid': true});
} else {
- throw new Error("Failed with HTTP code " + response.status);
+ throw new Error('Failed with HTTP code ' + response.status);
}
return response.json();
})
@@ -351,12 +350,12 @@ export class AccessibilityAnalysisView extends React.Component {
this.setState({
pieData: [
{
- x: "passes",
+ x: 'passes',
y: passes,
ratio: Math.round(100 * passes/total, 2)
},
{
- x: "violations",
+ x: 'violations',
y: violations,
ratio: Math.round(100 * violations/total, 2)
},
@@ -422,8 +421,7 @@ export class AccessibilityAnalysisView extends React.Component {
- } style={{backgroundColor: 'white'}}>
- {true &&
+ } style={{backgroundColor: 'white'}}>
-
- }
- {false &&
-
- }
- } style={{backgroundColor: "white"}}>
+ } style={{backgroundColor: 'white'}}>
true}/>
- } style={{backgroundColor: 'white'}}>
+ } style={{backgroundColor: 'white'}}>
diff --git a/frontend/src/views/accessibilitydashboard.js b/frontend/src/views/accessibilitydashboard.js
index eb3f95f0..51affc49 100644
--- a/frontend/src/views/accessibilitydashboard.js
+++ b/frontend/src/views/accessibilitydashboard.js
@@ -68,8 +68,8 @@ function runToRow(run, filterFunc, analysisViewId) {
badges.push(badge)
}
return {
- "cells": [
- analysisViewId ? {title: {run.id} {badges}} : run.id,
+ 'cells': [
+ analysisViewId ? {title: {run.id} {badges}} : run.id,
{title: },
{title: run.source},
{title: run.env},
@@ -257,7 +257,7 @@ export class AccessibilityDashboardView extends React.Component {
const operationMode = getOperationMode(operator);
let value = this.state.textFilter;
if (operationMode === 'multi') {
- value = this.state.inValues.join(";"); // translate list to ;-separated string for BE
+ value = this.state.inValues.join(';'); // translate list to ;-separated string for BE
}
else if (operationMode === 'bool') {
value = this.state.boolSelection;
@@ -312,14 +312,14 @@ export class AccessibilityDashboardView extends React.Component {
delete filters['project_id']
}
// get the widget ID for the analysis view
- HttpClient.get([Settings.serverUrl, 'widget-config'], {"filter": "widget=accessibility-analysis-view"})
+ HttpClient.get([Settings.serverUrl, 'widget-config'], {'filter': 'widget=accessibility-analysis-view'})
.then(response => HttpClient.handleResponse(response))
.then(data => {
analysisViewId = data.widgets[0]?.id
}).catch(error => {
console.log(error)
});
- params.filter.push("metadata.accessibility@t")
+ params.filter.push('metadata.accessibility@t')
// Convert UI filters to API filters
for (let key in filters) {
if (Object.prototype.hasOwnProperty.call(filters, key) && !!filters[key]) {
@@ -524,7 +524,7 @@ export class AccessibilityDashboardView extends React.Component {
toggle={boolToggle}
>
- {["True", "False"].map((option, index) => (
+ {['True', 'False'].map((option, index) => (
{option}
@@ -533,10 +533,10 @@ export class AccessibilityDashboardView extends React.Component {
}
{(filterMode === 'text' && operationMode === 'single') &&
- this.onTextChanged(newValue)} style={{height: "inherit"}}/>
+ this.onTextChanged(newValue)} style={{height: 'inherit'}}/>
}
{(operationMode === 'multi') &&
-
+
}
];
diff --git a/frontend/src/views/compareruns.js b/frontend/src/views/compareruns.js
index 6d5871a8..8f5f3f46 100644
--- a/frontend/src/views/compareruns.js
+++ b/frontend/src/views/compareruns.js
@@ -70,7 +70,7 @@ export class CompareRunsView extends React.Component {
onSkipCheck = (checked) => {
let filters = this.state.filters;
filters.forEach(filter => {
- filter["result"]["val"] = ("failed;error;passed") + ((checked) ? ";skipped;xfailed" : "")
+ filter['result']['val'] = ('failed;error;passed') + ((checked) ? ';skipped;xfailed' : '')
});
this.setState(
@@ -81,7 +81,7 @@ export class CompareRunsView extends React.Component {
setFilter = (filterId, field, value) => {
// maybe process values array to string format here instead of expecting caller to do it?
- let operator = (value.includes(";")) ? 'in' : 'eq';
+ let operator = (value.includes(';')) ? 'in' : 'eq';
this.updateFilters(filterId, field, operator, value)
}
@@ -101,7 +101,7 @@ export class CompareRunsView extends React.Component {
}
removeFilter = (filterId, id) => {
- if ((id !== "result") && (id !== "run_id")) { // Don't allow removal of error/failure filter
+ if ((id !== 'result') && (id !== 'run_id')) { // Don't allow removal of error/failure filter
this.updateFilters(filterId, id, null, null)
}
}
@@ -113,7 +113,7 @@ export class CompareRunsView extends React.Component {
let isNew = false;
filter.forEach(filter => {
for (const prop in filter) {
- if (prop !== "id" && prop !== "result") {
+ if (prop !== 'id' && prop !== 'result') {
isNew = true;
}
}
@@ -180,8 +180,8 @@ export class CompareRunsView extends React.Component {
let result = rows[rowIndex].result;
let hideSummary=true;
let hideTestObject=true;
- let defaultTab="test-history";
- if (result.result === "skipped") {
+ let defaultTab='test-history';
+ if (result.result === 'skipped') {
hideSummary=false;
hideTestObject=false;
}
@@ -252,7 +252,7 @@ export class CompareRunsView extends React.Component {
customFilters={{'result': filters['result']}}
activeFilters={this.state.filters[0]}
onRemoveFilter={this.removeFilter}
- hideFilters={["run_id", "project_id", "id"]}
+ hideFilters={['run_id', 'project_id', 'id']}
id={0}
/>
@@ -265,7 +265,7 @@ export class CompareRunsView extends React.Component {
customFilters={{'result': filters['result']}}
activeFilters={this.state.filters[1]}
onRemoveFilter={this.removeFilter}
- hideFilters={["run_id", "project_id", "id"]}
+ hideFilters={['run_id', 'project_id', 'id']}
id={1}
/>
@@ -310,7 +310,7 @@ export class CompareRunsView extends React.Component {
variant={TableVariant.compact}
filters={resultFilters}
onRemoveFilter={this.removeFilter}
- hideFilters={["project_id"]}
+ hideFilters={['project_id']}
/>
diff --git a/frontend/src/views/jenkinsjob.js b/frontend/src/views/jenkinsjob.js
index babb1ce8..69a03b1d 100644
--- a/frontend/src/views/jenkinsjob.js
+++ b/frontend/src/views/jenkinsjob.js
@@ -217,7 +217,7 @@ export class JenkinsJobView extends React.Component {
let value = this.state.textFilter.trim();
if (operationMode === 'multi') {
// translate list to ;-separated string for BE
- value = this.state.inValues.map(item => item.trim()).join(";");
+ value = this.state.inValues.map(item => item.trim()).join(';');
}
else if (operationMode === 'bool') {
value = this.state.boolSelection;
@@ -265,7 +265,7 @@ export class JenkinsJobView extends React.Component {
let params = this.props.view.params;
// get the widget ID for the analysis view
- HttpClient.get([Settings.serverUrl, 'widget-config'], {"filter": "widget=jenkins-analysis-view"})
+ HttpClient.get([Settings.serverUrl, 'widget-config'], {'filter': 'widget=jenkins-analysis-view'})
.then(response => HttpClient.handleResponse(response))
.then(data => {
analysisViewId = data.widgets[0]?.id
@@ -489,7 +489,7 @@ export class JenkinsJobView extends React.Component {
toggle={boolToggle}
>
- {["True", "False"].map((option, index) => (
+ {['True', 'False'].map((option, index) => (
{option}
@@ -498,10 +498,10 @@ export class JenkinsJobView extends React.Component {
}
{(filterMode === 'text' && operationMode === 'single') &&
- this.onTextChanged(newValue)} style={{height: "inherit"}}/>
+ this.onTextChanged(newValue)} style={{height: 'inherit'}}/>
}
{(operationMode === 'multi') &&
-
+
}
];
diff --git a/frontend/src/views/jenkinsjobanalysis.js b/frontend/src/views/jenkinsjobanalysis.js
index 65596b55..e350f603 100644
--- a/frontend/src/views/jenkinsjobanalysis.js
+++ b/frontend/src/views/jenkinsjobanalysis.js
@@ -118,7 +118,7 @@ export class JenkinsJobAnalysisView extends React.Component {
dropdownItems={dropdownItems}
defaultValue={defaultValue}
handleSelect={this.onBuildSelect}
- tooltip={"Set builds to:"}
+ tooltip="Set builds to:"
/>);
}
@@ -227,18 +227,18 @@ export class JenkinsJobAnalysisView extends React.Component {