mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix lint.
This commit is contained in:
@@ -15,7 +15,10 @@
|
||||
"es6": true,
|
||||
"jest": true
|
||||
},
|
||||
"plugins": ["react", "jsx-a11y"],
|
||||
"plugins": [
|
||||
"react",
|
||||
"jsx-a11y"
|
||||
],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:react/recommended",
|
||||
@@ -23,6 +26,18 @@
|
||||
"prettier",
|
||||
"prettier/react"
|
||||
],
|
||||
"globals": {
|
||||
"describe" :true,
|
||||
"context" :true,
|
||||
"before" :true,
|
||||
"beforeEach" :true,
|
||||
"after" :true,
|
||||
"afterEach" :true,
|
||||
"it" :true,
|
||||
"expect" :true,
|
||||
"workbox" :true,
|
||||
"importScripts" :true
|
||||
},
|
||||
"parser": "babel-eslint",
|
||||
"rules": {
|
||||
"no-fallthrough": "error",
|
||||
@@ -31,7 +46,10 @@
|
||||
"valid-typeof": "error",
|
||||
"no-func-assign": "error",
|
||||
"no-extra-semi": "error",
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"linebreak-style": [
|
||||
"error",
|
||||
"unix"
|
||||
],
|
||||
"no-unused-vars": "error",
|
||||
"no-console": "error",
|
||||
"no-undef": "error",
|
||||
@@ -63,7 +81,9 @@
|
||||
"react/prop-types": "error",
|
||||
"react/react-in-jsx-scope": "error",
|
||||
"react/no-string-refs": "error",
|
||||
"jsx-a11y/href-no-hash": [0],
|
||||
"jsx-a11y/href-no-hash": [
|
||||
0
|
||||
],
|
||||
"react/no-unescaped-entities": "error",
|
||||
"react/display-name": "error",
|
||||
"react/jsx-pascal-case": "error",
|
||||
@@ -84,4 +104,4 @@
|
||||
"version": "16.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +1,19 @@
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ const compression = require('compression');
|
||||
app.use(compression());
|
||||
|
||||
app.use('/', (req, res, next) => {
|
||||
//eslint-disable-next-line
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(req.method, ' ', req.originalUrl);
|
||||
return next();
|
||||
});
|
||||
@@ -55,6 +55,6 @@ app.get('/*', function(req, res) {
|
||||
});
|
||||
|
||||
const PORT = process.env.PORT || 3003;
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`This project is running on port ${PORT}`);
|
||||
app.listen(PORT);
|
||||
|
||||
@@ -95,7 +95,7 @@ process.on('message', function(data) {
|
||||
return scores;
|
||||
})
|
||||
.catch(err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -156,7 +156,6 @@ export const Validate = {
|
||||
},
|
||||
|
||||
isValidNumber(number) {
|
||||
// eslint-disable-next-line
|
||||
if (number.match('^[+]*[(]{0,1}[0-9]{1,4}[)]{0,1}[-s./0-9]*$')) {
|
||||
return true;
|
||||
}
|
||||
@@ -226,7 +225,6 @@ export const Validate = {
|
||||
},
|
||||
|
||||
isValidName(name) {
|
||||
// eslint-disable-next-line
|
||||
if (name.match('[A-Z][a-zA-Z][^#&<>"~;$^%{}?]{1,20}$')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable */
|
||||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
@@ -40,12 +39,6 @@ export function register(config) {
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
);
|
||||
});
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
registerValidSW(swUrl, config);
|
||||
@@ -81,10 +74,6 @@ function registerValidSW(swUrl, config) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
@@ -105,6 +94,7 @@ function registerValidSW(swUrl, config) {
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Error during service worker registration: ', error);
|
||||
});
|
||||
}
|
||||
@@ -132,6 +122,7 @@ function checkValidServiceWorker(swUrl, config) {
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.'
|
||||
);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable */
|
||||
const workboxBuild = require('workbox-build');
|
||||
|
||||
// NOTE: This should be run *AFTER* all your assets are built
|
||||
@@ -15,6 +14,9 @@ const buildSW = () => {
|
||||
// Optionally, log any warnings and details.
|
||||
return `${count} files will be precached, totaling ${size} bytes.`;
|
||||
})
|
||||
.catch(console.error);
|
||||
.catch(e => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
});
|
||||
};
|
||||
buildSW();
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/* eslint-disable */
|
||||
if ('function' === typeof importScripts) {
|
||||
importScripts(
|
||||
'https://storage.googleapis.com/workbox-cdn/releases/6.1.1/workbox-sw.js'
|
||||
);
|
||||
|
||||
/* global workbox */
|
||||
if (workbox) {
|
||||
const { skipWaiting, clientsClaim } = workbox.core;
|
||||
const { precacheAndRoute, cleanupOutdatedCaches } = workbox.precaching;
|
||||
@@ -19,6 +17,7 @@ if ('function' === typeof importScripts) {
|
||||
/* injection point for manifest files. */
|
||||
precacheAndRoute(self.__WB_MANIFEST, { cleanUrls: false });
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Workbox could not be loaded. No Offline support');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
@@ -484,7 +484,6 @@ export class Component extends React.Component {
|
||||
|
||||
Component.displayName = 'SettingsForm';
|
||||
|
||||
/* eslint-disable */
|
||||
Component.propTypes = {
|
||||
settings: PropTypes.object.isRequired,
|
||||
handleSubmit: PropTypes.func.isRequired,
|
||||
|
||||
@@ -424,7 +424,6 @@ export class Component extends React.Component {
|
||||
|
||||
Component.displayName = 'SettingsForm';
|
||||
|
||||
/* eslint-disable */
|
||||
Component.propTypes = {
|
||||
ssos: PropTypes.object.isRequired,
|
||||
fetchSsos: PropTypes.func.isRequired,
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
@@ -26,21 +26,21 @@ const cors = require('cors');
|
||||
app.use(cors());
|
||||
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Server Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in server process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in server process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
@@ -6,23 +6,23 @@ if (!NODE_ENV || NODE_ENV === 'development') {
|
||||
}
|
||||
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Application Scanner Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
'Unhandled rejection in application scanner process occurred'
|
||||
);
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in application scanner process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
|
||||
@@ -8,7 +8,7 @@ const ProjectService = require('../services/projectService');
|
||||
const sendErrorResponse = require('../middlewares/response').sendErrorResponse;
|
||||
const ObjectID = mongoose.Types.ObjectId;
|
||||
const MonitorService = require('../services/monitorService');
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
module.exports = {
|
||||
// Description: Checking if user is authorized to access the page and decode jwt to get user data.
|
||||
// Params:
|
||||
@@ -88,21 +88,18 @@ module.exports = {
|
||||
return true;
|
||||
},
|
||||
hasAPIKey: function(req) {
|
||||
let apiKey;
|
||||
if (req.query.apiKey) {
|
||||
apiKey = req.query.apiKey;
|
||||
return true;
|
||||
} else if (req.headers.apikey || req.headers.apiKey) {
|
||||
apiKey = req.headers.apikey;
|
||||
return true;
|
||||
} else if (req.body.apiKey) {
|
||||
apiKey = req.body.apiKey;
|
||||
} else {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
},
|
||||
|
||||
getProjectId: function(req, res) {
|
||||
getProjectId: function(req) {
|
||||
// Get Project Id, If Available
|
||||
let projectId;
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* eslint-disable quotes */
|
||||
|
||||
const ProjectService = require('../services/projectService');
|
||||
const ErrorService = require('../services/errorService');
|
||||
const url = require('url');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
@@ -102,6 +101,7 @@ module.exports = {
|
||||
|
||||
sendErrorResponse: function(req, res, error) {
|
||||
//log error to the console.
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(error);
|
||||
|
||||
if (error.statusCode && error.message) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
const MonitorCriteriaService = {
|
||||
getCriteria: function() {
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable quotes, indent */
|
||||
|
||||
module.exports = {
|
||||
//Description: Upsert function for monitor.
|
||||
//Params:
|
||||
@@ -803,11 +801,13 @@ module.exports = {
|
||||
const oneDay = moment()
|
||||
.subtract(1, 'days')
|
||||
.toDate();
|
||||
|
||||
const monitors = await MonitorModel.find({
|
||||
$and: [
|
||||
{
|
||||
deleted: false,
|
||||
disabled: false,
|
||||
type: 'url',
|
||||
},
|
||||
{
|
||||
$or: [
|
||||
@@ -825,13 +825,9 @@ module.exports = {
|
||||
{ lighthouseScannedAt: { $lt: oneDay } },
|
||||
],
|
||||
},
|
||||
{
|
||||
type: {
|
||||
$in: ['url'],
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
return monitors;
|
||||
} catch (error) {
|
||||
ErrorService.log('monitorService.getUrlMonitors', error);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable quotes */
|
||||
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
|
||||
@@ -14,21 +14,21 @@ if (!NODE_ENV || NODE_ENV === 'development') {
|
||||
}
|
||||
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Server Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in server process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in server process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
const userData = require('./data/user');
|
||||
process.env.PORT = 3020;
|
||||
process.env.ADMIN_EMAIL = userData.adminUser.email;
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
/* eslint-disable */
|
||||
process.env.PORT = 3020;
|
||||
process.env.NODE_ENV = 'development';
|
||||
let expect = require('chai').expect;
|
||||
let userData = require('./data/user');
|
||||
let incidentData = require('./data/incident');
|
||||
let chai = require('chai');
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
const incidentData = require('./data/incident');
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-http'));
|
||||
let app = require('../server');
|
||||
const app = require('../server');
|
||||
|
||||
let request = chai.request.agent(app);
|
||||
let { createUser } = require('./utils/userSignUp');
|
||||
const request = chai.request.agent(app);
|
||||
const { createUser } = require('./utils/userSignUp');
|
||||
const UserService = require('../backend/services/userService');
|
||||
const UserModel = require('../backend/models/user');
|
||||
const IncidentService = require('../backend/services/incidentService');
|
||||
@@ -22,18 +21,13 @@ const AirtableService = require('../backend/services/airtableService');
|
||||
const NotificationService = require('../backend/services/notificationService');
|
||||
const ComponentModel = require('../backend/models/component');
|
||||
|
||||
let token,
|
||||
userId,
|
||||
projectId,
|
||||
subProjectId,
|
||||
incidentId,
|
||||
alertId,
|
||||
monitorId,
|
||||
monitor = {
|
||||
name: 'New Monitor',
|
||||
type: 'url',
|
||||
data: { url: 'http://www.tests.org' },
|
||||
};
|
||||
let token, userId, projectId, subProjectId, incidentId, alertId, monitorId;
|
||||
|
||||
const monitor = {
|
||||
name: 'New Monitor',
|
||||
type: 'url',
|
||||
data: { url: 'http://www.tests.org' },
|
||||
};
|
||||
|
||||
describe('Alert API', function() {
|
||||
describe('Alert API without subprojects', function() {
|
||||
@@ -43,7 +37,7 @@ describe('Alert API', function() {
|
||||
this.timeout(30000);
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
createUser(request, userData.user, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
|
||||
@@ -62,7 +56,7 @@ describe('Alert API', function() {
|
||||
.end(function(err, res) {
|
||||
token =
|
||||
res.body.tokens.jwtAccessToken;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set(
|
||||
@@ -75,7 +69,9 @@ describe('Alert API', function() {
|
||||
})
|
||||
.end(function(err, res) {
|
||||
monitorId = res.body._id;
|
||||
incidentData.monitors = [monitorId];
|
||||
incidentData.monitors = [
|
||||
monitorId,
|
||||
];
|
||||
expect(res).to.have.status(
|
||||
200
|
||||
);
|
||||
@@ -104,7 +100,7 @@ describe('Alert API', function() {
|
||||
|
||||
// 'post /:projectId'
|
||||
it('should register with valid projectId, monitorId, incidentId, alertVia', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/incident/${projectId}/create-incident`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -119,7 +115,7 @@ describe('Alert API', function() {
|
||||
monitorId,
|
||||
alertVia: 'email',
|
||||
incidentId: incidentId,
|
||||
eventType: 'identified'
|
||||
eventType: 'identified',
|
||||
})
|
||||
.end(function(err, res) {
|
||||
alertId = res.body._id;
|
||||
@@ -131,7 +127,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should get an array of alerts by valid projectId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/alert/${projectId}/alert`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -145,7 +141,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should get an array alerts of by valid incidentId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/alert/${projectId}/incident/${incidentId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -159,7 +155,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should deleted alert', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/alert/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -170,7 +166,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should not delete alert with non-existing projectId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete('/alert/5f71e52737c855f7c5b347d3')
|
||||
.set('Authorization', authorization)
|
||||
@@ -181,13 +177,13 @@ describe('Alert API', function() {
|
||||
});
|
||||
});
|
||||
|
||||
let newUserToken, subProjectAlertId;
|
||||
let newUserToken;
|
||||
|
||||
describe('Alert API with Sub-Projects', function() {
|
||||
this.timeout(40000);
|
||||
before(function(done) {
|
||||
this.timeout(30000);
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
// create a subproject for parent project
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
request
|
||||
@@ -215,7 +211,7 @@ describe('Alert API', function() {
|
||||
.end(function(err, res) {
|
||||
newUserToken =
|
||||
res.body.tokens.jwtAccessToken;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
// add second user to subproject
|
||||
request
|
||||
.post(`/team/${subProjectId}`)
|
||||
@@ -228,7 +224,7 @@ describe('Alert API', function() {
|
||||
userData.newUser.email,
|
||||
role: 'Member',
|
||||
})
|
||||
.end(function(err, res) {
|
||||
.end(function() {
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -272,7 +268,7 @@ describe('Alert API', function() {
|
||||
password: userData.anotherUser.password,
|
||||
})
|
||||
.end(function(err, res) {
|
||||
let authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
|
||||
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
|
||||
request
|
||||
.post(`/alert/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -296,7 +292,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should create alert in parent project', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/alert/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -304,7 +300,7 @@ describe('Alert API', function() {
|
||||
monitorId: monitorId,
|
||||
alertVia: 'email',
|
||||
incidentId: incidentId,
|
||||
eventType: 'identified'
|
||||
eventType: 'identified',
|
||||
})
|
||||
.end(function(err, res) {
|
||||
alertId = res.body._id;
|
||||
@@ -315,7 +311,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should create alert in sub-project', function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.post(`/alert/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -323,10 +319,9 @@ describe('Alert API', function() {
|
||||
monitorId: monitorId,
|
||||
alertVia: 'email',
|
||||
incidentId: incidentId,
|
||||
eventType: 'identified'
|
||||
eventType: 'identified',
|
||||
})
|
||||
.end(function(err, res) {
|
||||
subProjectAlertId = res.body._id;
|
||||
expect(res).to.have.status(200);
|
||||
expect(res.body).to.be.an('object');
|
||||
done();
|
||||
@@ -334,7 +329,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should get only sub-project alerts for valid user.', function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.get(`/alert/${subProjectId}/alert`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -348,7 +343,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should get both project and sub-project alerts for valid user.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/alert/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -364,7 +359,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should delete sub-project alert', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/alert/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -375,7 +370,7 @@ describe('Alert API', function() {
|
||||
});
|
||||
|
||||
it('should delete project alert', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/alert/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const chai = require('chai');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,27 +1,31 @@
|
||||
/* eslint-disable */
|
||||
process.env.PORT = 3020;
|
||||
let expect = require('chai').expect;
|
||||
let userData = require('./data/user');
|
||||
let chai = require('chai');
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-http'));
|
||||
chai.use(require('chai-subset'));
|
||||
let app = require('../server');
|
||||
let GlobalConfig = require('./utils/globalConfig');
|
||||
let request = chai.request.agent(app);
|
||||
let { createUser } = require('./utils/userSignUp');
|
||||
let UserService = require('../backend/services/userService');
|
||||
let ProjectService = require('../backend/services/projectService');
|
||||
let ComponentService = require('../backend/services/componentService');
|
||||
let NotificationService = require('../backend/services/notificationService');
|
||||
let AirtableService = require('../backend/services/airtableService');
|
||||
const app = require('../server');
|
||||
const GlobalConfig = require('./utils/globalConfig');
|
||||
const request = chai.request.agent(app);
|
||||
const { createUser } = require('./utils/userSignUp');
|
||||
const UserService = require('../backend/services/userService');
|
||||
const ProjectService = require('../backend/services/projectService');
|
||||
const ComponentService = require('../backend/services/componentService');
|
||||
const NotificationService = require('../backend/services/notificationService');
|
||||
const AirtableService = require('../backend/services/airtableService');
|
||||
const gitCredential = require('./data/gitCredential');
|
||||
const GitCredentialService = require('../backend/services/gitCredentialService');
|
||||
const dockerCredential = require('./data/dockerCredential');
|
||||
const DockerCredentialService = require('../backend/services/dockerCredentialService');
|
||||
|
||||
let VerificationTokenModel = require('../backend/models/verificationToken');
|
||||
const VerificationTokenModel = require('../backend/models/verificationToken');
|
||||
|
||||
let token, userId, projectId, componentId, monitorId, resourceCount = 0;
|
||||
let token,
|
||||
userId,
|
||||
projectId,
|
||||
componentId,
|
||||
monitorId,
|
||||
resourceCount = 0;
|
||||
|
||||
describe('Component API', function() {
|
||||
this.timeout(30000);
|
||||
@@ -30,7 +34,7 @@ describe('Component API', function() {
|
||||
this.timeout(80000);
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
createUser(request, userData.user, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
|
||||
@@ -71,7 +75,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should not create a component when the `name` field is null', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/component/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -85,7 +89,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should create a new component when the correct data is given by an authenticated user', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/component/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -101,7 +105,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should update a component when the correct data is given by an authenticated user', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.put(`/component/${projectId}/${componentId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -116,7 +120,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should get components for an authenticated user by ProjectId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/component/${projectId}/component`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -130,7 +134,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should get a component for an authenticated user with valid componentId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/component/${projectId}/component/${componentId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -143,7 +147,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should create a new monitor when `componentId` is given`', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -177,7 +181,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should create a new application log when `componentId` is given then get list of resources`', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/application-log/${projectId}/${componentId}/create`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -200,13 +204,15 @@ describe('Component API', function() {
|
||||
expect(res.body.totalResources[1].status).to.be.equal(
|
||||
'No logs yet'
|
||||
);
|
||||
expect(res.body.totalResources).to.have.lengthOf(resourceCount); // one application log and one monitor
|
||||
expect(res.body.totalResources).to.have.lengthOf(
|
||||
resourceCount
|
||||
); // one application log and one monitor
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
it('should create a new application log then creater a log when `componentId` is given then get list of resources`', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/application-log/${projectId}/${componentId}/create`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -262,7 +268,6 @@ describe('Component API', function() {
|
||||
gitPassword: gitCredential.gitPassword,
|
||||
projectId,
|
||||
}).then(function(credential) {
|
||||
credentialId = credential._id;
|
||||
const data = {
|
||||
name: 'Test',
|
||||
gitRepositoryUrl: gitCredential.gitRepositoryUrl,
|
||||
@@ -274,7 +279,6 @@ describe('Component API', function() {
|
||||
.set('Authorization', authorization)
|
||||
.send(data)
|
||||
.end(function(err, res) {
|
||||
applicationSecurityId = res.body._id;
|
||||
expect(res).to.have.status(200);
|
||||
resourceCount++; // Increment Resource Count
|
||||
expect(res.body.componentId).to.be.equal(componentId);
|
||||
@@ -291,7 +295,9 @@ describe('Component API', function() {
|
||||
.end(function(err, res) {
|
||||
expect(res).to.have.status(200);
|
||||
expect(res.body.totalResources).to.be.an('array');
|
||||
expect(res.body.totalResources).to.have.lengthOf(resourceCount); // two application logs, one monitor and one application log security
|
||||
expect(res.body.totalResources).to.have.lengthOf(
|
||||
resourceCount
|
||||
); // two application logs, one monitor and one application log security
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -307,7 +313,6 @@ describe('Component API', function() {
|
||||
dockerRegistryUrl: dockerCredential.dockerRegistryUrl,
|
||||
projectId,
|
||||
}).then(function(credential) {
|
||||
credentialId = credential._id;
|
||||
const data = {
|
||||
name: 'Test Container',
|
||||
dockerCredential: credential._id,
|
||||
@@ -320,7 +325,6 @@ describe('Component API', function() {
|
||||
.set('Authorization', authorization)
|
||||
.send(data)
|
||||
.end(function(err, res) {
|
||||
containerSecurityId = res.body._id;
|
||||
expect(res).to.have.status(200);
|
||||
resourceCount++; // Increment Resource Count
|
||||
expect(res.body.componentId).to.be.equal(componentId);
|
||||
@@ -333,7 +337,9 @@ describe('Component API', function() {
|
||||
.end(function(err, res) {
|
||||
expect(res).to.have.status(200);
|
||||
expect(res.body.totalResources).to.be.an('array');
|
||||
expect(res.body.totalResources).to.have.lengthOf(resourceCount); // tws application logs, one monitor, one application log security and one container security
|
||||
expect(res.body.totalResources).to.have.lengthOf(
|
||||
resourceCount
|
||||
); // tws application logs, one monitor, one application log security and one container security
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -341,7 +347,7 @@ describe('Component API', function() {
|
||||
});
|
||||
|
||||
it('should delete a component and its monitor when componentId is valid', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/component/${projectId}/${componentId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -373,7 +379,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
this.timeout(30000);
|
||||
before(function(done) {
|
||||
this.timeout(30000);
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
// create a subproject for parent project
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
request
|
||||
@@ -384,7 +390,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
subProjectId = res.body[0]._id;
|
||||
// sign up second user (subproject user)
|
||||
createUser(request, userData.newUser, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
newProjectId = project._id;
|
||||
newUserId = res.body.id;
|
||||
|
||||
@@ -408,7 +414,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
newUserToken =
|
||||
res.body.tokens
|
||||
.jwtAccessToken;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
// add second user to subproject
|
||||
request
|
||||
.post(
|
||||
@@ -465,7 +471,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
|
||||
it('should not create a component for user not present in project', function(done) {
|
||||
createUser(request, userData.anotherUser, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
otherProjectId = project._id;
|
||||
otherUserId = res.body.id;
|
||||
|
||||
@@ -484,7 +490,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
password: userData.anotherUser.password,
|
||||
})
|
||||
.end(function(err, res) {
|
||||
let authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
|
||||
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
|
||||
request
|
||||
.post(`/component/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -503,7 +509,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should not create a component for user that is not `admin` in project.', function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.post(`/component/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -520,7 +526,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should create a component in parent project by valid admin.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/component/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -536,7 +542,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should not create a component with exisiting name in sub-project.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/component/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -553,7 +559,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should create a component in sub-project.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/component/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -569,7 +575,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it("should get only sub-project's components for valid sub-project user", function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.get(`/component/${subProjectId}/component`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -585,7 +591,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should get both project and sub-project components for valid parent project user.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/component/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -601,7 +607,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should not delete a component for user that is not `admin` in sub-project.', function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.delete(`/component/${subProjectId}/${subProjectComponentId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -615,7 +621,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should delete sub-project component', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/component/${subProjectId}/${subProjectComponentId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -626,7 +632,7 @@ describe('Component API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should delete project component', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/component/${projectId}/${newComponentId}`)
|
||||
.set('Authorization', authorization)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const chai = require('chai');
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const data = require('./data/user');
|
||||
@@ -29,7 +27,7 @@ describe('Email SMTP Api Test', function() {
|
||||
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
const userId = res.body.id;
|
||||
|
||||
const verificationToken = await VerificationTokenModel.findOne({
|
||||
userId,
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-useless-escape, no-undef */
|
||||
|
||||
const expect = require('chai').expect;
|
||||
process.env.PORT = 3020;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
@@ -24,7 +22,6 @@ describe('Enterprise Component API', function() {
|
||||
createEnterpriseUser(request, userData.user, function(err, res) {
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
airtableId = res.body.airtableId;
|
||||
|
||||
request
|
||||
.post('/user/login')
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const data = require('./data/user');
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
@@ -56,7 +54,7 @@ describe('Enterprise Team API', function() {
|
||||
role: 'Member',
|
||||
})
|
||||
.end(function(err, res) {
|
||||
anotherUser = res.body[0].team[0].userId;
|
||||
expect(res.body[0].team[0].userId).to.be.truthy();
|
||||
expect(res).to.have.status(200);
|
||||
expect(res.body).to.be.an('array');
|
||||
done();
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const data = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const data = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const HTTP_TEST_SERVER_URL = 'http://localhost:3010';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
process.env.PORT = 3020;
|
||||
const userData = require('./data/user');
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,30 +1,29 @@
|
||||
/* eslint-disable */
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
let expect = require('chai').expect;
|
||||
let userData = require('./data/user');
|
||||
let chai = require('chai');
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-http'));
|
||||
chai.use(require('chai-subset'));
|
||||
let app = require('../server');
|
||||
let GlobalConfig = require('./utils/globalConfig');
|
||||
let request = chai.request.agent(app);
|
||||
let { createUser } = require('./utils/userSignUp');
|
||||
let UserService = require('../backend/services/userService');
|
||||
let ProjectService = require('../backend/services/projectService');
|
||||
let MonitorService = require('../backend/services/monitorService');
|
||||
let ResourceCategoryService = require('../backend/services/resourceCategoryService');
|
||||
let NotificationService = require('../backend/services/notificationService');
|
||||
let AirtableService = require('../backend/services/airtableService');
|
||||
const app = require('../server');
|
||||
const GlobalConfig = require('./utils/globalConfig');
|
||||
const request = chai.request.agent(app);
|
||||
const { createUser } = require('./utils/userSignUp');
|
||||
const UserService = require('../backend/services/userService');
|
||||
const ProjectService = require('../backend/services/projectService');
|
||||
const MonitorService = require('../backend/services/monitorService');
|
||||
const ResourceCategoryService = require('../backend/services/resourceCategoryService');
|
||||
const NotificationService = require('../backend/services/notificationService');
|
||||
const AirtableService = require('../backend/services/airtableService');
|
||||
const uuid = require('uuid');
|
||||
|
||||
let VerificationTokenModel = require('../backend/models/verificationToken');
|
||||
let ComponentModel = require('../backend/models/component');
|
||||
const VerificationTokenModel = require('../backend/models/verificationToken');
|
||||
const ComponentModel = require('../backend/models/component');
|
||||
|
||||
let token, userId, projectId, monitorId, resourceCategoryId, monitor2Id;
|
||||
const httpMonitorId = uuid.v4();
|
||||
const httpMonitor2Id = uuid.v4();
|
||||
let resourceCategory = {
|
||||
const resourceCategory = {
|
||||
resourceCategoryName: 'New Monitor Category',
|
||||
};
|
||||
|
||||
@@ -76,7 +75,7 @@ describe('Monitor API', function() {
|
||||
this.timeout(30000);
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
createUser(request, userData.user, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
|
||||
@@ -142,7 +141,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not create a monitor when the `name` field is null', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -159,7 +158,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not create a monitor when the `type` field is null', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -176,7 +175,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not create a monitor when the `data` field is not valid', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -193,7 +192,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not create an agentless server monitor when identityFile authentication is selected and the `identityFile` field is not valid', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -212,7 +211,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should create a new monitor when the correct data is given by an authenticated user', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -231,7 +230,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should add a new site url to a monitor', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}/siteUrl/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -247,7 +246,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should remove a site url from a monitor', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/monitor/${projectId}/siteUrl/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -263,8 +262,8 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not create a new monitor with invalid call schedule', function(done) {
|
||||
let scheduleId = 20;
|
||||
let authorization = `Basic ${token}`;
|
||||
const scheduleId = 20;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -283,7 +282,7 @@ describe('Monitor API', function() {
|
||||
|
||||
it('should create a new monitor with valid call schedule', function(done) {
|
||||
let scheduleId;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/schedule/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -324,7 +323,7 @@ describe('Monitor API', function() {
|
||||
|
||||
it('should create two new monitors and add them to one call schedule', function(done) {
|
||||
let scheduleId;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/schedule/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -382,7 +381,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should update a monitor when the correct data is given by an authenticated user', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.put(`/monitor/${projectId}/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -401,7 +400,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should get monitors for an authenticated user by ProjectId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/monitor/${projectId}/monitor`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -415,7 +414,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should get a monitor for an authenticated user with valid monitorId', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/monitor/${projectId}/monitor/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -428,7 +427,7 @@ describe('Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should delete a monitor when monitorId is valid', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/monitor/${projectId}/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -450,7 +449,7 @@ describe('API Monitor API', function() {
|
||||
this.timeout(30000);
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
createUser(request, userData.user, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
|
||||
@@ -509,7 +508,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not add API monitor with invalid website url', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -530,7 +529,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not add API monitor with invalid url', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -548,7 +547,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not add API monitor with empty or invalid header', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -567,7 +566,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not add API monitor with empty body', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -587,7 +586,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not add API monitor with invalid body', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -609,7 +608,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should add API monitor with valid url', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -629,7 +628,7 @@ describe('API Monitor API', function() {
|
||||
});
|
||||
|
||||
it('should not edit API monitor with invalid url', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.put(`/monitor/${projectId}/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -657,7 +656,7 @@ describe('IncomingHttpRequest Monitor', function() {
|
||||
this.timeout(30000);
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
createUser(request, userData.user, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
|
||||
@@ -705,7 +704,7 @@ describe('IncomingHttpRequest Monitor', function() {
|
||||
});
|
||||
|
||||
it('should create a new IncomingHttpRequest monitor', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -771,7 +770,7 @@ describe('IncomingHttpRequest Monitor', function() {
|
||||
});
|
||||
|
||||
it('should create a new IncomingHttpRequest monitor with query params and request headers', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
const criteria = { ...httpMonitorCriteria };
|
||||
criteria.up.and.push({
|
||||
responseType: 'queryString',
|
||||
@@ -836,7 +835,7 @@ describe('Monitor API with resource Category', function() {
|
||||
this.timeout(40000);
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
createUser(request, userData.user, function(err, res) {
|
||||
let project = res.body.project;
|
||||
const project = res.body.project;
|
||||
projectId = project._id;
|
||||
userId = res.body.id;
|
||||
VerificationTokenModel.findOne({ userId }, function(
|
||||
@@ -855,7 +854,7 @@ describe('Monitor API with resource Category', function() {
|
||||
})
|
||||
.end(function(err, res) {
|
||||
token = res.body.tokens.jwtAccessToken;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/resourceCategory/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -879,7 +878,7 @@ describe('Monitor API with resource Category', function() {
|
||||
});
|
||||
|
||||
it('should create a new monitor when the resource Category is provided by an authenticated user', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -909,7 +908,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
this.timeout(30000);
|
||||
before(function(done) {
|
||||
GlobalConfig.initTestConfig().then(function() {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
// create a subproject for parent project
|
||||
request
|
||||
.post(`/project/${projectId}/subProject`)
|
||||
@@ -939,7 +938,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
.end(function(err, res) {
|
||||
newUserToken =
|
||||
res.body.tokens.jwtAccessToken;
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
// add second user to subproject
|
||||
request
|
||||
.post(`/team/${subProjectId}`)
|
||||
@@ -987,7 +986,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
password: userData.anotherUser.password,
|
||||
})
|
||||
.end(function(err, res) {
|
||||
let authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
|
||||
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1011,7 +1010,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should not create a monitor for user that is not `admin` in project.', function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.post(`/monitor/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1031,7 +1030,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should create a monitor in parent project by valid admin.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1050,7 +1049,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should create a monitor in sub-project.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.post(`/monitor/${subProjectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1069,7 +1068,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it("should get only sub-project's monitors for valid sub-project user", function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.get(`/monitor/${subProjectId}/monitor`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1085,7 +1084,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should get both project and sub-project monitors for valid parent project user.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.get(`/monitor/${projectId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1101,7 +1100,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should not delete a monitor for user that is not `admin` in sub-project.', function(done) {
|
||||
let authorization = `Basic ${newUserToken}`;
|
||||
const authorization = `Basic ${newUserToken}`;
|
||||
request
|
||||
.delete(`/monitor/${subProjectId}/${subProjectMonitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1115,7 +1114,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should delete sub-project monitor', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/monitor/${subProjectId}/${subProjectMonitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1126,7 +1125,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
});
|
||||
|
||||
it('should delete project monitor', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
request
|
||||
.delete(`/monitor/${projectId}/${monitorId}`)
|
||||
.set('Authorization', authorization)
|
||||
@@ -1140,7 +1139,7 @@ describe('Monitor API with Sub-Projects', function() {
|
||||
describe('Monitor API - Tests Project Seats With SubProjects', function() {
|
||||
this.timeout(30000);
|
||||
|
||||
let monitorDataArray = [
|
||||
const monitorDataArray = [
|
||||
{
|
||||
name: 'New Monitor1',
|
||||
type: 'url',
|
||||
@@ -1196,7 +1195,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
|
||||
before(async function() {
|
||||
this.timeout(30000);
|
||||
await GlobalConfig.initTestConfig();
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
|
||||
await MonitorService.hardDeleteBy({ projectId });
|
||||
|
||||
@@ -1228,7 +1227,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
|
||||
});
|
||||
|
||||
it('should not create a new monitor because the monitor count limit is reached (Startup Plan -> 5 monitors/user).', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
|
||||
request
|
||||
.post(`/monitor/${projectId}`)
|
||||
@@ -1249,7 +1248,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
|
||||
});
|
||||
|
||||
it('should be able to create more monitor on upgrade of project to Growth plan.', function(done) {
|
||||
let authorization = `Basic ${token}`;
|
||||
const authorization = `Basic ${token}`;
|
||||
const growthPlan = 'plan_GoWKgxRnPPBJWy';
|
||||
|
||||
const project = ProjectService.changePlan(
|
||||
@@ -1298,8 +1297,8 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
|
||||
});*/
|
||||
|
||||
it('should delete a monitor', async () => {
|
||||
let authorization = `Basic ${token}`;
|
||||
let res = await request
|
||||
const authorization = `Basic ${token}`;
|
||||
const res = await request
|
||||
.delete(`/monitor/${projectId}/${monitorId}`)
|
||||
.set('Authorization', authorization);
|
||||
expect(res).to.have.status(200);
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable linebreak-style, no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
const expect = require('chai').expect;
|
||||
const chai = require('chai');
|
||||
chai.use(require('chai-http'));
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-useless-escape, no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable quotes, no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
process.env.IS_SAAS_SERVICE = true;
|
||||
const expect = require('chai').expect;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable linebreak-style, no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const data = require('./data/user');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-undef */
|
||||
|
||||
process.env.PORT = 3020;
|
||||
const expect = require('chai').expect;
|
||||
const userData = require('./data/user');
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
@@ -29,7 +29,7 @@ fs.readdir(directory, function(err, files) {
|
||||
const chunkRegex = /2\.(.+)\.chunk\.(js)$/;
|
||||
const mainChunkRegex = /main\.(.+)\.chunk\.(js)$/;
|
||||
if (err) {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Unable to scan directory: ', err);
|
||||
}
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable react/no-unused-state */
|
||||
import React, { Component } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { bindActionCreators } from 'redux';
|
||||
@@ -386,7 +385,7 @@ export class AddScheduleModal extends Component {
|
||||
schedules={schedules}
|
||||
data={data}
|
||||
changeButton={this.changeButton}
|
||||
stateData={this.state}
|
||||
stateData={{ ...this.state }}
|
||||
backup={false}
|
||||
disabled={disabled}
|
||||
changeBackupButton={
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
import React from 'react';
|
||||
import * as moment from 'moment';
|
||||
import Badge from '../common/Badge';
|
||||
|
||||
@@ -19,7 +19,7 @@ function submitMonitorForm(values, dispatch, props) {
|
||||
const subProjectId = props && props.subProjectId;
|
||||
const scheduleId = props && props.scheduleId;
|
||||
const monitors = [];
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
for (const id in values) {
|
||||
if (
|
||||
Object.prototype.hasOwnProperty.call(values, id) &&
|
||||
|
||||
@@ -17,7 +17,7 @@ import { SHOULD_LOG_ANALYTICS } from '../../config';
|
||||
function submitUserForm(values, dispatch, props) {
|
||||
const scheduleId = props && props.scheduleId;
|
||||
const users = [];
|
||||
/* eslint-disable no-unused-vars */
|
||||
|
||||
for (const id in values) {
|
||||
if (Object.prototype.hasOwnProperty.call(values, id)) {
|
||||
values[id] && users.push(id);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
import {
|
||||
FETCH_COMPONENTS_SUCCESS,
|
||||
FETCH_COMPONENTS_FAILURE,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
import {
|
||||
FETCH_MONITORS_SUCCESS,
|
||||
FETCH_MONITORS_FAILURE,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable */
|
||||
// This optional code is used to register a service worker.
|
||||
// register() is not called by default.
|
||||
|
||||
@@ -42,12 +41,7 @@ export function register(config) {
|
||||
checkValidServiceWorker(swUrl, config);
|
||||
// Add some additional logging to localhost, pointing developers to the
|
||||
// service worker/PWA documentation.
|
||||
navigator.serviceWorker.ready.then(() => {
|
||||
console.log(
|
||||
'This web app is being served cache-first by a service ' +
|
||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
||||
);
|
||||
});
|
||||
|
||||
registerValidSW(swUrl, config);
|
||||
} else {
|
||||
// Is not localhost. Just register service worker
|
||||
@@ -63,7 +57,7 @@ function registerValidSW(swUrl, config) {
|
||||
event.waitUntil(
|
||||
caches.keys().then(function(cacheNames) {
|
||||
// grab the updated cache names
|
||||
let validCacheSet = new Set(
|
||||
const validCacheSet = new Set(
|
||||
Object.values(workbox.core.cacheNames)
|
||||
);
|
||||
return Promise.all(
|
||||
@@ -95,10 +89,6 @@ function registerValidSW(swUrl, config) {
|
||||
// At this point, the updated precached content has been fetched,
|
||||
// but the previous service worker will still serve the older
|
||||
// content until all client tabs are closed.
|
||||
console.log(
|
||||
'New content is available and will be used when all ' +
|
||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
||||
);
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onUpdate) {
|
||||
@@ -108,7 +98,6 @@ function registerValidSW(swUrl, config) {
|
||||
// At this point, everything has been precached.
|
||||
// It's the perfect time to display a
|
||||
// "Content is cached for offline use." message.
|
||||
console.log('Content is cached for offline use.');
|
||||
|
||||
// Execute callback
|
||||
if (config && config.onSuccess) {
|
||||
@@ -120,6 +109,7 @@ function registerValidSW(swUrl, config) {
|
||||
};
|
||||
})
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(
|
||||
'response Error during service worker registration: ',
|
||||
error
|
||||
@@ -138,9 +128,6 @@ function checkValidServiceWorker(swUrl, config) {
|
||||
(contentType != null &&
|
||||
contentType.indexOf('javascript') === -1)
|
||||
) {
|
||||
console.log(
|
||||
'This registers the sw file for the push notification'
|
||||
);
|
||||
// No service worker found. Probably a different app. Reload the page.
|
||||
navigator.serviceWorker.ready.then(registration => {
|
||||
registration.unregister().then(() => {
|
||||
@@ -153,6 +140,7 @@ function checkValidServiceWorker(swUrl, config) {
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
'No internet connection found. App is running in offline mode.',
|
||||
err
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable */
|
||||
const workboxBuild = require('workbox-build');
|
||||
|
||||
// NOTE: This should be run *AFTER* all your assets are built
|
||||
@@ -15,6 +14,9 @@ const buildSW = () => {
|
||||
// Optionally, log any warnings and details.
|
||||
return `${count} files will be precached, totaling ${size} bytes.`;
|
||||
})
|
||||
.catch(console.error);
|
||||
.catch(e => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
});
|
||||
};
|
||||
buildSW();
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
/* eslint-disable */
|
||||
if ('function' === typeof importScripts) {
|
||||
importScripts(
|
||||
'https://storage.googleapis.com/workbox-cdn/releases/6.1.1/workbox-sw.js'
|
||||
);
|
||||
|
||||
/* global workbox */
|
||||
if (workbox) {
|
||||
const { skipWaiting, clientsClaim } = workbox.core;
|
||||
const { precacheAndRoute, cleanupOutdatedCaches } = workbox.precaching;
|
||||
@@ -31,6 +29,7 @@ if ('function' === typeof importScripts) {
|
||||
});
|
||||
});
|
||||
} else {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Workbox could not be loaded. No Offline support');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable no-console */
|
||||
/**
|
||||
*
|
||||
* Copyright HackerBay, Inc.
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable linebreak-style */
|
||||
process.env.PORT = 3424;
|
||||
const expect = require('chai').expect;
|
||||
const chai = require('chai');
|
||||
|
||||
@@ -95,7 +95,7 @@ process.on('message', function(data) {
|
||||
return scores;
|
||||
})
|
||||
.catch(err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
process.on('exit', () => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('Shutting Shutdown');
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Unhandled rejection in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
process.on('uncaughtException', err => {
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Uncaught exception in process occurred');
|
||||
/* eslint-disable no-console */
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user