Skip to content
Snippets Groups Projects
Commit 8398ca42 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

added gitlab formatter

parent db6aece5
No related branches found
No related tags found
1 merge request!1188TMSS-2810 "Multiple TMSS FrontEnd Unit tests Fixed"
......@@ -958,7 +958,7 @@ eslint_TMSSFrontEnd:
- cd /builds/ro/lofar/SAS/TMSS/frontend/tmss_webapp
- mkdir quality
- ls -al
- npx eslint -f json . --output-file=quality/eslint.json || true
- npx eslint --format gitlab . --output-file=quality/eslint.json || true
- ls -al
- echo "done"
......
This diff is collapsed.
......@@ -92,6 +92,7 @@
"babel-polyfill": "^6.26.0",
"customize-cra": "^1.0.0",
"eslint": "^8.51.0",
"eslint-formatter-gitlab": "^5.0.0",
"jest-canvas-mock": "^2.5.0",
"jest-expect-message": "^1.1.3",
"jest-junit": "^16.0.0",
......@@ -11093,6 +11094,101 @@
"eslint": "^8.0.0"
}
},
"node_modules/eslint-formatter-gitlab": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-formatter-gitlab/-/eslint-formatter-gitlab-5.0.0.tgz",
"integrity": "sha512-4mF/Bam1xAzsNNYE7kWN/qBQD4mSMkDBEw5AoMLY4oU5iY7BxTxcAzs253FNnUKc5FvduD4Q4+/RW9l1xjz7Zg==",
"dev": true,
"dependencies": {
"chalk": "^4.0.0",
"yaml": "^2.0.0"
},
"funding": {
"url": "https://github.com/sponsors/remcohaszing"
},
"peerDependencies": {
"eslint": "^5 || ^6 || ^7 || ^8"
}
},
"node_modules/eslint-formatter-gitlab/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/eslint-formatter-gitlab/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/eslint-formatter-gitlab/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/eslint-formatter-gitlab/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
},
"node_modules/eslint-formatter-gitlab/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-formatter-gitlab/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-formatter-gitlab/node_modules/yaml": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.3.3.tgz",
"integrity": "sha512-zw0VAJxgeZ6+++/su5AFoqBbZbrEakwu+X0M5HmcwUiBL7AzcuPKjj5we4xfQLp78LkEMpD0cOnUhmgOVy3KdQ==",
"dev": true,
"engines": {
"node": ">= 14"
}
},
"node_modules/eslint-import-resolver-node": {
"version": "0.3.6",
"dev": true,
......
......@@ -142,6 +142,7 @@
"babel-polyfill": "^6.26.0",
"customize-cra": "^1.0.0",
"eslint": "^8.51.0",
"eslint-formatter-gitlab": "^5.0.0",
"jest-canvas-mock": "^2.5.0",
"jest-expect-message": "^1.1.3",
"jest-junit": "^16.0.0",
......
......@@ -111,7 +111,6 @@ test("Verify Mock Calls", async () => {
});
// TODO : Fix Unit test Changes a text field
test("Changes a text field", async () => {
let pageContent = await renderPage(<SchedulingUnitCreate location={{ pathname: '/schedulingunit/create' }} />);
await waitFor (() => expect (pageContent.queryByTestId('name')).toBeInTheDocument());
......@@ -124,7 +123,6 @@ test("Changes a text field", async () => {
// TODO : Fix Unit Test Selects a project, loads the project's sets and selects the test scheduling set
test("Selects a project, loads the project's sets and selects the test scheduling set", async () => {
let pageContent = await renderPage(<SchedulingUnitCreate location={{ pathname: '/schedulingunit/create' }} />);
let scheduleSetListSpy = jest.spyOn(ScheduleService, 'getSchedulingSets').mockImplementation((filter) => {
......
......@@ -123,7 +123,7 @@ describe('Scheduling Units Excel View create page default', () => {
// TODO : Fix Unit Test Scheduling Units Excel View create page with an observation strategy template
describe('Scheduling Units Excel View create page with an observation strategy template', () => {
let pageContent;
......
import {render,act} from "@testing-library/react";
import TimelineItemPopover, {getFieldsHtml} from "./TimelineItemPopover";
import { render, act } from "@testing-library/react";
import TimelineItemPopover, { getFieldsHtml } from "./TimelineItemPopover";
import moment from "moment";
import {removeReact18ConsoleErrors} from "../../../utils/test.helper";
import { removeReact18ConsoleErrors } from "../../../utils/test.helper";
import UIConstants from "../../../utils/ui.constants";
import renderer from 'react-test-renderer';
removeReact18ConsoleErrors()
......@@ -24,21 +24,21 @@ describe("TimelineItemPopover", () => {
on_sky_duration: 2.5,
duration: 3.5,
};
test("Render type SCHEDULE for a schedulable item", () => {
test("Render type SCHEDULE for a schedulable item", () => {
let pagecontent
act(async () => {
pagecontent = render(<TimelineItemPopover mouseOverItem={mouseOverItemSchedule}/>);
pagecontent = render(<TimelineItemPopover mouseOverItem={mouseOverItemSchedule} />);
});
const renderedFields = pagecontent.container.querySelectorAll(".entry");
const fieldLabels = ["Project:", "Scheduling Unit:", "Scheduler:", "Start Time:", "End Time:", "Antenna Set:", "Stations:", "Status:", "Exposure Time:", "Duration:"];
const fieldValues = [mouseOverItemSchedule.project, mouseOverItemSchedule.name, mouseOverItemSchedule.scheduler,
mouseOverItemSchedule.suStartTime.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItemSchedule.suStopTime.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItemSchedule.antenna_set,
`${mouseOverItemSchedule.stations.groups} : ${mouseOverItemSchedule.stations.counts}`, mouseOverItemSchedule.status, mouseOverItemSchedule.on_sky_duration.toString(), mouseOverItemSchedule.duration.toString(),
mouseOverItemSchedule.suStartTime.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItemSchedule.suStopTime.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItemSchedule.antenna_set,
`${mouseOverItemSchedule.stations.groups} : ${mouseOverItemSchedule.stations.counts}`, mouseOverItemSchedule.status, mouseOverItemSchedule.on_sky_duration.toString(), mouseOverItemSchedule.duration.toString(),
];
renderedFields.forEach((field, index) => {
......@@ -66,17 +66,17 @@ describe("TimelineItemPopover", () => {
duration: 2,
planned: true,
};
let pagecontent
act(async () => {
pagecontent = render(<TimelineItemPopover mouseOverItem={mouseOverItem}/>);
pagecontent = render(<TimelineItemPopover mouseOverItem={mouseOverItem} />);
});
const renderedFields = pagecontent.container.querySelectorAll(".entry");
const fieldLabels = ["Name:", "Description:", "Type:", "Stations:", "Project:", "Start Time:", "End Time:", "Duration:", "Planned:"];
const fieldValues = [mouseOverItem.name, mouseOverItem.desc, mouseOverItem.activity_type, `${mouseOverItemSchedule.stations.groups} : ${mouseOverItemSchedule.stations.counts}`, mouseOverItem.project,
mouseOverItem.displayStartTime.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItem.displayEndTime.format(UIConstants.CALENDAR_DATETIME_FORMAT),
mouseOverItem.duration.toString(), "Yes"
mouseOverItem.displayStartTime.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItem.displayEndTime.format(UIConstants.CALENDAR_DATETIME_FORMAT),
mouseOverItem.duration.toString(), "Yes"
];
renderedFields.forEach((field, index) => {
......@@ -102,14 +102,14 @@ describe("TimelineItemPopover", () => {
};
let pagecontent
act(async () => {
pagecontent = render(<TimelineItemPopover mouseOverItem={mouseOverItem}/>);
pagecontent = render(<TimelineItemPopover mouseOverItem={mouseOverItem} />);
});
const renderedFields = pagecontent.container.querySelectorAll(".entry");
const fieldLabels = ["Name:", "Description:", "Type:", "Stations:", "Project:", "Start Time:", "End Time:", "Duration:", "Planned:"];
const fieldValues = [mouseOverItem.name, mouseOverItem.desc, mouseOverItem.activity_type, "-", mouseOverItem.project,
mouseOverItem.real_start_time.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItem.real_end_time.format(UIConstants.CALENDAR_DATETIME_FORMAT),
mouseOverItem.duration.toString(), "Yes"
mouseOverItem.real_start_time.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItem.real_end_time.format(UIConstants.CALENDAR_DATETIME_FORMAT),
mouseOverItem.duration.toString(), "Yes"
];
renderedFields.forEach((field, index) => {
......@@ -138,13 +138,13 @@ describe("TimelineItemPopover", () => {
duration: "2 hours",
};
const {container} = render(<TimelineItemPopover mouseOverItem={mouseOverItem}/>);
const { container } = render(<TimelineItemPopover mouseOverItem={mouseOverItem} />);
const renderedFields = container.querySelectorAll(".entry");
const fieldLabels = ["Project:", "Scheduling Unit:", "Task Id:", "Task Name:", "Control Id:", "Start Time:", "End Time:", "HBA/LBA:", "Stations:", "Status:", "Duration:"];
const fieldValues = [mouseOverItem.project, mouseOverItem.name, mouseOverItem.taskId, mouseOverItem.taskName, mouseOverItem.controlId,
mouseOverItem.start_time.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItem.end_time.format(UIConstants.CALENDAR_DATETIME_FORMAT),
mouseOverItem.band, `${mouseOverItemSchedule.stations.groups} : ${mouseOverItemSchedule.stations.counts}`, mouseOverItem.status, mouseOverItem.duration
mouseOverItem.start_time.format(UIConstants.CALENDAR_DATETIME_FORMAT), mouseOverItem.end_time.format(UIConstants.CALENDAR_DATETIME_FORMAT),
mouseOverItem.band, `${mouseOverItemSchedule.stations.groups} : ${mouseOverItemSchedule.stations.counts}`, mouseOverItem.status, mouseOverItem.duration
];
renderedFields.forEach((field, index) => {
......@@ -155,7 +155,7 @@ describe("TimelineItemPopover", () => {
})
test.each([null, undefined, {}])('Render nothing on invalid input: %s', (mouseOverItem) => {
const {queryByText} = render(<TimelineItemPopover mouseOverItem={mouseOverItem}/>);
const { queryByText } = render(<TimelineItemPopover mouseOverItem={mouseOverItem} />);
expect(queryByText("Reservation Overview")).not.toBeInTheDocument();
expect(queryByText("Scheduling Unit Overview")).not.toBeInTheDocument();
......@@ -164,8 +164,8 @@ describe("TimelineItemPopover", () => {
describe("getFieldsHtml", () => {
const fields = [
{label: "Project:", value: "X-men"},
{label: "Scheduling Unit:", value: "Wolverine"},
{ label: "Project:", value: "X-men" },
{ label: "Scheduling Unit:", value: "Wolverine" },
];
// This is a snapshot test now. This means it validates against a
......@@ -173,18 +173,18 @@ describe("getFieldsHtml", () => {
test('Render fields with the correct label, value, and classNames', () => {
const status = "scheduled";
const style = {color: "blue"};
const style = { color: "blue" };
const page = renderer
.create(getFieldsHtml(fields, status, style))
.toJSON();
.create(getFieldsHtml(fields, status, style))
.toJSON();
expect(page).toMatchSnapshot();
})
})
test("Render fields without status and style", () => {
const page = renderer
.create( getFieldsHtml(fields))
.toJSON();
.create(getFieldsHtml(fields))
.toJSON();
expect(page).toMatchSnapshot();
})
});
\ No newline at end of file
})
});
\ No newline at end of file
......@@ -46,12 +46,9 @@ describe('ZoomAndMove', () => {
})
// TODO : Fix unit test renders loading spinner when props are not yet available
it('renders loading spinner when props are not yet available', () => {
let moctm = mockTimelineStore;
const {getByRole}= render(
<ZoomAndMove
timelineStore={moctm}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment