Run unit test in zuul
Change-Id: I0d0b57a576d1a6faba9121236b87653b6ab973d6
This commit is contained in:
parent
7bae0ba80a
commit
b58c5feb54
21
.zuul.yaml
21
.zuul.yaml
@ -1,5 +1,18 @@
|
|||||||
|
|
||||||
- job:
|
- job:
|
||||||
name: ara-build-dashboard
|
name: ara-web-unit-tests
|
||||||
|
parent: nodejs-npm
|
||||||
|
description: Run unit tests
|
||||||
|
files:
|
||||||
|
- src/.*
|
||||||
|
- .zuul.yaml
|
||||||
|
- zuul-playbooks/.*
|
||||||
|
vars:
|
||||||
|
node_version: 8
|
||||||
|
run: zuul-playbooks/test.yaml
|
||||||
|
|
||||||
|
- job:
|
||||||
|
name: ara-web-build-dashboard
|
||||||
# https://zuul.openstack.org/job/build-javascript-content
|
# https://zuul.openstack.org/job/build-javascript-content
|
||||||
parent: build-javascript-content
|
parent: build-javascript-content
|
||||||
description: |
|
description: |
|
||||||
@ -20,10 +33,12 @@
|
|||||||
pre-run: zuul-playbooks/pre.yaml
|
pre-run: zuul-playbooks/pre.yaml
|
||||||
run: zuul-playbooks/build-dashboard.yaml
|
run: zuul-playbooks/build-dashboard.yaml
|
||||||
|
|
||||||
|
|
||||||
- project:
|
- project:
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- ara-build-dashboard
|
- ara-web-unit-tests
|
||||||
|
- ara-web-build-dashboard
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- ara-build-dashboard
|
- ara-web-unit-tests
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"test": "react-scripts test --env=jsdom",
|
"test": "CI=true react-scripts test --env=jsdom",
|
||||||
|
"test:watch": "react-scripts test --env=jsdom",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
import React from 'react';
|
import React from "react";
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from "react-dom";
|
||||||
import App from './App';
|
import axios from "axios";
|
||||||
|
import axiosMockAdapter from "axios-mock-adapter";
|
||||||
|
|
||||||
it('renders without crashing', () => {
|
import App from "./App";
|
||||||
const div = document.createElement('div');
|
|
||||||
|
const axiosMock = new axiosMockAdapter(axios);
|
||||||
|
|
||||||
|
it("renders without crashing", () => {
|
||||||
|
axiosMock.onGet("config.json").reply(200, {
|
||||||
|
apiURL: "http://localhost:8000"
|
||||||
|
});
|
||||||
|
const div = document.createElement("div");
|
||||||
ReactDOM.render(<App />, div);
|
ReactDOM.render(<App />, div);
|
||||||
ReactDOM.unmountComponentAtNode(div);
|
ReactDOM.unmountComponentAtNode(div);
|
||||||
});
|
});
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import * as actions from "./configActions";
|
import * as actions from "./configActions";
|
||||||
import * as types from "./playbooksActionsTypes";
|
import * as types from "./configActionsTypes";
|
||||||
|
|
||||||
it("setConfig", () => {
|
it("setConfig", () => {
|
||||||
const config = { apiURL: "http://example.org" };
|
const config = { apiURL: "http://example.org" };
|
||||||
const expectedActions = [
|
const expectedActions = {
|
||||||
{
|
type: types.SET_CONFIG,
|
||||||
type: types.SET_CONFIG,
|
config
|
||||||
config
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
expect(actions.setConfig(config)).toEqual(expectedActions);
|
expect(actions.setConfig(config)).toEqual(expectedActions);
|
||||||
});
|
});
|
||||||
|
7
zuul-playbooks/test.yaml
Normal file
7
zuul-playbooks/test.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
- name: Test ARA web
|
||||||
|
hosts: all
|
||||||
|
roles:
|
||||||
|
- role: npm
|
||||||
|
npm_command: build
|
||||||
|
- role: npm
|
||||||
|
npm_command: test
|
Loading…
x
Reference in New Issue
Block a user