mirror of
https://github.com/ansible/awx.git
synced 2026-02-28 16:28:43 -03:30
set default timezone to UTC for test runs
This commit is contained in:
committed by
Marliana Lara
parent
475645f604
commit
2a926fffd9
@@ -5,8 +5,8 @@
|
|||||||
"main": "index.jsx",
|
"main": "index.jsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --config ./webpack.config.js --mode development",
|
"start": "webpack-dev-server --config ./webpack.config.js --mode development",
|
||||||
"test": "jest --coverage",
|
"test": "TZ='UTC' jest --coverage",
|
||||||
"test-watch": "jest --watch",
|
"test-watch": "TZ='UTC' jest --watch",
|
||||||
"lint": "eslint --ext .js --ext .jsx .",
|
"lint": "eslint --ext .js --ext .jsx .",
|
||||||
"add-locale": "lingui add-locale",
|
"add-locale": "lingui add-locale",
|
||||||
"extract-strings": "lingui extract",
|
"extract-strings": "lingui extract",
|
||||||
|
|||||||
@@ -24,12 +24,6 @@ const selectors = {
|
|||||||
lineText: 'JobEvent__JobEventLineText',
|
lineText: 'JobEvent__JobEventLineText',
|
||||||
};
|
};
|
||||||
|
|
||||||
function tzHours(hours) {
|
|
||||||
const date = new Date();
|
|
||||||
date.setUTCHours(hours);
|
|
||||||
return date.getHours();
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('<JobEvent />', () => {
|
describe('<JobEvent />', () => {
|
||||||
test('initially renders successfully', () => {
|
test('initially renders successfully', () => {
|
||||||
mountWithContexts(<JobEvent {...mockOnPlayStartEvent} />);
|
mountWithContexts(<JobEvent {...mockOnPlayStartEvent} />);
|
||||||
@@ -39,7 +33,7 @@ describe('<JobEvent />', () => {
|
|||||||
let wrapper = mountWithContexts(<JobEvent {...mockOnPlayStartEvent} />);
|
let wrapper = mountWithContexts(<JobEvent {...mockOnPlayStartEvent} />);
|
||||||
let lineText = wrapper.find(selectors.lineText);
|
let lineText = wrapper.find(selectors.lineText);
|
||||||
expect(
|
expect(
|
||||||
lineText.filterWhere(e => e.html().includes(`${tzHours(18)}:11:22`))
|
lineText.filterWhere(e => e.text().includes('18:11:22'))
|
||||||
).toHaveLength(1);
|
).toHaveLength(1);
|
||||||
|
|
||||||
const singleDigitTimestampEvent = {
|
const singleDigitTimestampEvent = {
|
||||||
@@ -49,7 +43,7 @@ describe('<JobEvent />', () => {
|
|||||||
wrapper = mountWithContexts(<JobEvent {...singleDigitTimestampEvent} />);
|
wrapper = mountWithContexts(<JobEvent {...singleDigitTimestampEvent} />);
|
||||||
lineText = wrapper.find(selectors.lineText);
|
lineText = wrapper.find(selectors.lineText);
|
||||||
expect(
|
expect(
|
||||||
lineText.filterWhere(e => e.html().includes(`${tzHours(8)}:01:02`))
|
lineText.filterWhere(e => e.text().includes('08:01:02'))
|
||||||
).toHaveLength(1);
|
).toHaveLength(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import mockJobEventsData from './data.job_events.json';
|
|||||||
jest.mock('@api');
|
jest.mock('@api');
|
||||||
|
|
||||||
async function checkOutput(wrapper, expectedLines) {
|
async function checkOutput(wrapper, expectedLines) {
|
||||||
await waitForElement(wrapper, 'div[type="job_event"]', e => e.length > 1);
|
await waitForElement(wrapper, 'div[type="job_event"]', el => el.length > 1);
|
||||||
const jobEventLines = wrapper.find('div[type="job_event_line_text"]');
|
const jobEventLines = wrapper.find('div[type="job_event_line_text"]');
|
||||||
const actualLines = [];
|
const actualLines = [];
|
||||||
jobEventLines.forEach(line => {
|
jobEventLines.forEach(line => {
|
||||||
@@ -65,9 +65,9 @@ describe('<JobOutput />', () => {
|
|||||||
await waitForElement(wrapper, 'JobEvent', el => el.length > 0);
|
await waitForElement(wrapper, 'JobEvent', el => el.length > 0);
|
||||||
await checkOutput(wrapper, [
|
await checkOutput(wrapper, [
|
||||||
'',
|
'',
|
||||||
'PLAY [all] *********************************************************************11:37:25',
|
'PLAY [all] *********************************************************************15:37:25',
|
||||||
'',
|
'',
|
||||||
'TASK [debug] *******************************************************************11:37:25',
|
'TASK [debug] *******************************************************************15:37:25',
|
||||||
'ok: [localhost] => (item=1) => {',
|
'ok: [localhost] => (item=1) => {',
|
||||||
' "msg": "This is a debug message: 1"',
|
' "msg": "This is a debug message: 1"',
|
||||||
'}',
|
'}',
|
||||||
@@ -171,7 +171,7 @@ describe('<JobOutput />', () => {
|
|||||||
'handleScrollLast'
|
'handleScrollLast'
|
||||||
);
|
);
|
||||||
wrapper = mountWithContexts(<JobOutput job={mockJob} />);
|
wrapper = mountWithContexts(<JobOutput job={mockJob} />);
|
||||||
await waitForElement(wrapper, 'EmptyStateBody', e => e.length === 0);
|
await waitForElement(wrapper, 'EmptyStateBody', el => el.length === 0);
|
||||||
wrapper
|
wrapper
|
||||||
.find('JobOutput')
|
.find('JobOutput')
|
||||||
.instance()
|
.instance()
|
||||||
@@ -190,7 +190,7 @@ describe('<JobOutput />', () => {
|
|||||||
test('should throw error', async done => {
|
test('should throw error', async done => {
|
||||||
JobsAPI.readEvents = () => Promise.reject(new Error());
|
JobsAPI.readEvents = () => Promise.reject(new Error());
|
||||||
wrapper = mountWithContexts(<JobOutput job={mockJob} />);
|
wrapper = mountWithContexts(<JobOutput job={mockJob} />);
|
||||||
await waitForElement(wrapper, 'ContentError', e => e.length === 1);
|
await waitForElement(wrapper, 'ContentError', el => el.length === 1);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user