diff --git a/accounts/index.ts b/accounts/index.ts index e01088643f..9a04f583d8 100755 --- a/accounts/index.ts +++ b/accounts/index.ts @@ -9,9 +9,9 @@ import compression from 'compression'; app.use(compression()); -app.get(['/env.js', '/accounts/env.js'], function( - req: $TSFixMe, - res: $TSFixMe +app.get(['/env.js', '/accounts/env.js'], function ( + req: Request, + req: Response ) { const env = { REACT_APP_IS_SAAS_SERVICE: process.env.IS_SAAS_SERVICE, @@ -69,7 +69,7 @@ app.use( app.use('/accounts', express.static(path.join(__dirname, 'build'))); -app.get('/*', function(req: Request, res: Response) { +app.get('/*', function (req: Request, res: Response) { res.sendFile(path.join(__dirname, 'build', 'index.html')); }); diff --git a/admin-dashboard/src/components/settings/smtp.tsx b/admin-dashboard/src/components/settings/smtp.tsx index a6f0f7ccf1..17be2388d0 100644 --- a/admin-dashboard/src/components/settings/smtp.tsx +++ b/admin-dashboard/src/components/settings/smtp.tsx @@ -240,7 +240,7 @@ export class Component extends React.Component { smtpToUse, }; - return testSmtp(payload).then((res: $TSFixMe) => { + return testSmtp(payload).then((req: Response) => { if (res && typeof res === 'string') { // prevent dismissal of modal if errored // res will only be a string if errored @@ -352,7 +352,7 @@ export class Component extends React.Component { settings.requesting } /> - // @ts-expect-error ts-migrate(2339) FIXME: Property 'explanation' does not exist on type '{ k... Remove this comment to see the full error message + // @ts-expect-error ts-migrate(2339) FIXME: Property 'explanation' does not exist on type '{k... Remove this comment to see the full error message {field.explanation && (
{
@@ -366,12 +366,12 @@ export class Component extends React.Component {
))}
{smtpForm.values &&
smtpForm.values[
- 'email-enabled'
+ 'email-enabled'
] &&
smtpOptions.map(field => {
if (
field.key ===
- 'internalSmtp' &&
+ 'internalSmtp' &&
!IS_INTERNAL_SMTP_DEPLOYED
) {
return null;
@@ -428,7 +428,7 @@ export class Component extends React.Component {
})}
{smtpForm.values &&
smtpForm.values[
- 'email-enabled'
+ 'email-enabled'
] &&
smtpForm.values.customSmtp &&
fields.map(field => (
diff --git a/application-scanner/package.json b/application-scanner/package.json
index d0024f4c53..1a117ff163 100644
--- a/application-scanner/package.json
+++ b/application-scanner/package.json
@@ -29,7 +29,7 @@
"ping": "^0.4.1",
"simple-git": "^2.40.0",
"ssh2": "^0.8.9",
- "uuid": "^3.4.0",
+ "uuid": "^8.3.2",
"winston": "^3.3.3",
"winston-slack-transport": "^2.0.0"
}
diff --git a/backend/backend/api/monitor.ts b/backend/backend/api/monitor.ts
index eab00ac151..af230701b5 100755
--- a/backend/backend/api/monitor.ts
+++ b/backend/backend/api/monitor.ts
@@ -36,7 +36,7 @@ const httpsAgent = new https.Agent({
// Params:
// Param 1: req.params-> {projectId}; req.body -> {[_id], name, type, data, visibleOnStatusPage} <- Check MonitorMoal for description.
// Returns: response status, error message
-router.post('/:projectId', getUser, isAuthorized, isUserAdmin, async function(
+router.post('/:projectId', getUser, isAuthorized, isUserAdmin, async function (
req,
res
) {
@@ -274,7 +274,7 @@ router.post('/:projectId', getUser, isAuthorized, isUserAdmin, async function(
}
});
-router.post('/:projectId/identityFile', async function(
+router.post('/:projectId/identityFile', async function (
req: Request,
res: Response
) {
@@ -287,7 +287,7 @@ router.post('/:projectId/identityFile', async function(
maxCount: 1,
},
]);
- upload(req, res, async function(error: $TSFixMe) {
+ upload(req, res, async function (error: $TSFixMe) {
let identityFile;
if (error) {
return sendErrorResponse(req, res, error);
@@ -306,7 +306,7 @@ router.post('/:projectId/identityFile', async function(
}
});
-router.post('/:projectId/configurationFile', async function(
+router.post('/:projectId/configurationFile', async function (
req: Request,
res: Response
) {
@@ -319,7 +319,7 @@ router.post('/:projectId/configurationFile', async function(
maxCount: 1,
},
]);
- upload(req, res, async function(error: $TSFixMe) {
+ upload(req, res, async function (error: $TSFixMe) {
let configurationFile;
if (error) {
return sendErrorResponse(req, res, error);
@@ -343,7 +343,7 @@ router.put(
getUser,
isAuthorized,
isUserAdmin,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const data = req.body;
const { monitorId } = req.params;
@@ -434,7 +434,7 @@ router.put(
// Route
// Description: Get all Monitors by projectId.
-router.get('/:projectId', getUser, isAuthorized, getSubProjects, async function(
+router.get('/:projectId', getUser, isAuthorized, getSubProjects, async function (
req,
res
) {
@@ -456,7 +456,7 @@ router.get('/:projectId', getUser, isAuthorized, getSubProjects, async function(
}
});
-router.get('/:projectId/paginated', getUser, isAuthorized, async function(
+router.get('/:projectId/paginated', getUser, isAuthorized, async function (
req,
res
) {
@@ -504,7 +504,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const type = req.query.type;
@@ -549,7 +549,7 @@ router.get(
getUser,
isAuthorized,
getSubProjects,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const monitorId = req.params.monitorId;
const type = req.query.type;
@@ -589,7 +589,7 @@ router.post(
'/:projectId/monitorLogs/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const {
skip,
@@ -645,7 +645,7 @@ router.delete(
getUser,
isAuthorized,
isUserAdmin,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
const { monitorId, projectId } = req.params;
try {
const monitor = await MonitorService.deleteBy(
@@ -676,7 +676,7 @@ router.post(
getUser,
isAuthorized,
isUserAdmin,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const monitorId = req.params.monitorId || req.body._id;
const data = req.body;
@@ -695,10 +695,10 @@ router.post(
} =
monitor && monitor.criteria && monitor.criteria.up
? ProbeService.conditions(
- monitor.type,
- monitor.criteria.up,
- data
- )
+ monitor.type,
+ monitor.criteria.up,
+ data
+ )
: { stat: false, failedReasons: [], successReasons: [] };
const {
stat: validDegraded,
@@ -707,10 +707,10 @@ router.post(
} =
monitor && monitor.criteria && monitor.criteria.degraded
? ProbeService.conditions(
- monitor.type,
- monitor.criteria.degraded,
- data
- )
+ monitor.type,
+ monitor.criteria.degraded,
+ data
+ )
: { stat: false, failedReasons: [], successReasons: [] };
const {
stat: validDown,
@@ -719,10 +719,10 @@ router.post(
} =
monitor && monitor.criteria && monitor.criteria.down
? ProbeService.conditions(
- monitor.type,
- monitor.criteria.down,
- data
- )
+ monitor.type,
+ monitor.criteria.down,
+ data
+ )
: { stat: false, failedReasons: [], successReasons: [] };
if (validUp) {
@@ -771,7 +771,7 @@ router.post(
'/:projectId/monitorLog/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { startDate, endDate } = req.body;
const monitorId = req.params.monitorId;
@@ -793,7 +793,7 @@ router.post(
'/:projectId/monitorStatuses/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { startDate, endDate } = req.body;
const monitorId = req.params.monitorId;
@@ -815,7 +815,7 @@ router.get(
'/:projectId/lighthouseLog/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { skip, limit, url } = req.query;
const monitorId = req.params.monitorId;
@@ -841,7 +841,7 @@ router.get(
'/:projectId/lighthouseIssue/:issueId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const selectLighthouseLogs =
'monitorId probeId data url performance accessibility bestPractices seo pwa createdAt scanning';
@@ -870,7 +870,7 @@ router.post(
'/:projectId/inbound/:deviceId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
return await _updateDeviceMonitorPingTime(req, res);
}
);
@@ -879,14 +879,14 @@ router.get(
'/:projectId/inbound/:deviceId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
return await _updateDeviceMonitorPingTime(req, res);
}
);
-const _updateDeviceMonitorPingTime = async function(
- req: $TSFixMe,
- res: $TSFixMe
+const _updateDeviceMonitorPingTime = async function (
+ req: Request,
+ req: Response
) {
try {
const projectId = req.params.projectId;
@@ -924,7 +924,7 @@ const _updateDeviceMonitorPingTime = async function(
}
};
-router.post('/:projectId/addseat', getUser, isAuthorized, async function(
+router.post('/:projectId/addseat', getUser, isAuthorized, async function (
req,
res
) {
@@ -942,7 +942,7 @@ router.post(
'/:projectId/siteUrl/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { siteUrl } = req.body;
const monitor = await MonitorService.addSiteUrl(
@@ -962,7 +962,7 @@ router.delete(
'/:projectId/siteUrl/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { siteUrl } = req.body;
const monitor = await MonitorService.removeSiteUrl(
@@ -982,7 +982,7 @@ router.get(
'/:projectId/monitorSlaBreaches',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId } = req.params;
const select =
@@ -1002,7 +1002,7 @@ router.post(
'/:projectId/closeSla/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, monitorId } = req.params;
@@ -1024,7 +1024,7 @@ router.post(
'/:projectId/disableMonitor/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { monitorId } = req.params;
const select = 'disabled';
@@ -1059,7 +1059,7 @@ router.post(
'/:projectId/changeComponent/:monitorId',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, monitorId } = req.params;
const { newComponentId } = req.body;
@@ -1076,7 +1076,7 @@ router.post(
);
// api to calculate time for monitorInfo (status page)
-router.post('/:monitorId/calculate-time', async function(
+router.post('/:monitorId/calculate-time', async function (
req: Request,
res: Response
) {
diff --git a/backend/backend/api/statusPage.ts b/backend/backend/api/statusPage.ts
index 1fa206c782..5c219b8e88 100755
--- a/backend/backend/api/statusPage.ts
+++ b/backend/backend/api/statusPage.ts
@@ -359,7 +359,7 @@ router.put(
}
);
-router.post('/:projectId/certFile', async function(
+router.post('/:projectId/certFile', async function (
req: Request,
res: Response
) {
@@ -372,7 +372,7 @@ router.post('/:projectId/certFile', async function(
maxCount: 1,
},
]);
- upload(req, res, async function(error: $TSFixMe) {
+ upload(req, res, async function (error: $TSFixMe) {
let cert;
if (error) {
return sendErrorResponse(req, res, error);
@@ -388,7 +388,7 @@ router.post('/:projectId/certFile', async function(
}
});
-router.post('/:projectId/privateKeyFile', async function(
+router.post('/:projectId/privateKeyFile', async function (
req: Request,
res: Response
) {
@@ -401,7 +401,7 @@ router.post('/:projectId/privateKeyFile', async function(
maxCount: 1,
},
]);
- upload(req, res, async function(error: $TSFixMe) {
+ upload(req, res, async function (error: $TSFixMe) {
let privateKey;
if (error) {
return sendErrorResponse(req, res, error);
@@ -422,7 +422,7 @@ router.post('/:projectId/privateKeyFile', async function(
// fetch details about a custom domain
// to be consumed by the status page
-router.get('/tlsCredential', async function(req: Request, res: Response) {
+router.get('/tlsCredential', async function (req: Request, res: Response) {
try {
const { domain } = req.query;
@@ -502,7 +502,7 @@ router.delete(
// Params:
// Param1:
// Returns: response status, error message
-router.put('/:projectId', getUser, isAuthorized, isUserAdmin, async function(
+router.put('/:projectId', getUser, isAuthorized, isUserAdmin, async function (
req,
res
) {
@@ -575,7 +575,7 @@ router.put('/:projectId', getUser, isAuthorized, isUserAdmin, async function(
}
}
- upload(req, res, async function(error: $TSFixMe) {
+ upload(req, res, async function (error: $TSFixMe) {
const files = req.files || {};
const data = req.body;
data.projectId = req.params.projectId;
@@ -698,7 +698,7 @@ router.put('/:projectId', getUser, isAuthorized, isUserAdmin, async function(
});
});
-router.get('/statusBubble', async function(req: Request, res: Response) {
+router.get('/statusBubble', async function (req: Request, res: Response) {
const statusPageId = req.query.statusPageId;
const statusBubbleId = req.query.statusBubbleId;
try {
@@ -776,7 +776,7 @@ router.get('/statusBubble', async function(req: Request, res: Response) {
// Param1: req.params-> {projectId};
// Returns: response status, error message
-router.get('/:projectId/dashboard', getUser, isAuthorized, async function(
+router.get('/:projectId/dashboard', getUser, isAuthorized, async function (
req,
res
) {
@@ -824,7 +824,7 @@ router.get('/:projectId/dashboard', getUser, isAuthorized, async function(
}
});
-router.get('/:projectId/status-pages', getUser, isAuthorized, async function(
+router.get('/:projectId/status-pages', getUser, isAuthorized, async function (
req,
res
) {
@@ -843,7 +843,7 @@ router.get('/:projectId/status-pages', getUser, isAuthorized, async function(
}
});
-router.get('/:projectId/statuspage', getUser, isAuthorized, async function(
+router.get('/:projectId/statuspage', getUser, isAuthorized, async function (
req,
res
) {
@@ -890,7 +890,7 @@ router.get('/:projectId/statuspage', getUser, isAuthorized, async function(
});
// External status page api - get the data to show on status page using Slug
-router.get('/:statusPageSlug', checkUser, ipWhitelist, async function(
+router.get('/:statusPageSlug', checkUser, ipWhitelist, async function (
req,
res
) {
@@ -962,7 +962,7 @@ router.post(
'/:projectId/:statusPageSlug/duplicateStatusPage',
getUser,
isAuthorized,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, statusPageSlug } = req.params;
const { subProjectId } = req.query;
@@ -996,7 +996,7 @@ router.post(
}
);
-router.get('/:statusPageId/rss', checkUser, async function(
+router.get('/:statusPageId/rss', checkUser, async function (
req: Request,
res: Response
) {
@@ -1044,17 +1044,14 @@ router.get('/:statusPageId/rss', checkUser, async function(
guid: `${global.apiHost}/status-page/${statusPageId}/rss/${incident._id}`,
pubDate: new Date(incident.createdAt).toUTCString(),
- description: `Incident Id: ${incident._id.toString()}
Monitor Name(s): ${handleMonitorList(
- incident.monitors
- )}
Acknowledge Time: ${
- incident.acknowledgedAt
- }
Resolve Time: ${incident.resolvedAt}
${
- incident.investigationNote
+ description: `Incident Id: ${incident._id.toString()}
Monitor Name(s): ${handleMonitorList(
+ incident.monitors
+ )}
Acknowledge Time: ${incident.acknowledgedAt
+ }
Resolve Time: ${incident.resolvedAt}
${incident.investigationNote
? `Investigation Note: ${incident.investigationNote}`
: ''
- }]]>`,
+ }]]>`,
},
});
}
@@ -1104,7 +1101,7 @@ router.get(
'/:projectId/:statusPageSlug/notes',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
let result;
const statusPageSlug = req.params.statusPageSlug;
const skip = req.query.skip || 0;
@@ -1152,7 +1149,7 @@ router.get(
}
);
-router.get('/:projectId/incident/:incidentSlug', checkUser, async function(
+router.get('/:projectId/incident/:incidentSlug', checkUser, async function (
req,
res
) {
@@ -1173,7 +1170,7 @@ router.get('/:projectId/incident/:incidentSlug', checkUser, async function(
}
});
-router.get('/:projectId/:incidentSlug/incidentNotes', checkUser, async function(
+router.get('/:projectId/:incidentSlug/incidentNotes', checkUser, async function (
req,
res
) {
@@ -1198,7 +1195,7 @@ router.get('/:projectId/:incidentSlug/incidentNotes', checkUser, async function(
}
});
-router.get('/:projectId/:monitorId/individualnotes', checkUser, async function(
+router.get('/:projectId/:monitorId/individualnotes', checkUser, async function (
req,
res
) {
@@ -1275,7 +1272,7 @@ router.get(
'/:projectId/:statusPageSlug/events',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
const statusPageSlug = req.params.statusPageSlug;
const skip = req.query.skip || 0;
const limit = req.query.limit || 5;
@@ -1307,7 +1304,7 @@ router.get(
'/:projectId/:statusPageSlug/futureEvents',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
const { skip = 0, limit = 5, theme } = req.query;
@@ -1332,7 +1329,7 @@ router.get(
'/:projectId/:statusPageSlug/pastEvents',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
const { skip = 0, limit = 5, theme } = req.query;
@@ -1375,7 +1372,7 @@ const fetchNotes = async (events: $TSFixMe, limit: $TSFixMe) => {
}
};
-router.get('/:projectId/notes/:scheduledEventSlug', checkUser, async function(
+router.get('/:projectId/notes/:scheduledEventSlug', checkUser, async function (
req,
res
) {
@@ -1401,7 +1398,7 @@ router.get('/:projectId/notes/:scheduledEventSlug', checkUser, async function(
}
});
-router.get('/:projectId/:monitorId/individualevents', checkUser, async function(
+router.get('/:projectId/:monitorId/individualevents', checkUser, async function (
req,
res
) {
@@ -1460,7 +1457,7 @@ router.get('/:projectId/:monitorId/individualevents', checkUser, async function(
router.get(
'/:projectId/scheduledEvent/:scheduledEventId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
const { scheduledEventId } = req.params;
try {
@@ -1475,7 +1472,7 @@ router.get(
);
// Route
// Description: Get all Monitor Statuses by monitorId
-router.post('/:projectId/:monitorId/monitorStatuses', checkUser, async function(
+router.post('/:projectId/:monitorId/monitorStatuses', checkUser, async function (
req,
res
) {
@@ -1493,7 +1490,7 @@ router.post('/:projectId/:monitorId/monitorStatuses', checkUser, async function(
}
});
-router.post('/:projectId/:monitorId/monitorLogs', checkUser, async function(
+router.post('/:projectId/:monitorId/monitorLogs', checkUser, async function (
req,
res
) {
@@ -1537,7 +1534,7 @@ router.post('/:projectId/:monitorId/monitorLogs', checkUser, async function(
}
});
-router.get('/:projectId/probes', checkUser, async function(
+router.get('/:projectId/probes', checkUser, async function (
req: Request,
res: Response
) {
@@ -1566,7 +1563,7 @@ router.delete(
getUser,
isAuthorized,
isUserAdmin,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
const statusPageSlug = req.params.statusPageSlug;
const userId = req.user ? req.user.id : null;
@@ -1583,7 +1580,7 @@ router.delete(
}
);
-router.get('/:projectId/timeline/:incidentSlug', checkUser, async function(
+router.get('/:projectId/timeline/:incidentSlug', checkUser, async function (
req,
res
) {
@@ -1624,7 +1621,7 @@ router.get(
'/:projectId/:statusPageSlug/timelines',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -1644,7 +1641,7 @@ router.get(
//get subscribers by monitorId in a statuspage
// req.params-> {projectId, monitorId, statusPageId};
// Returns: response subscribers, error message
-router.get('/:projectId/monitor/:statusPageId', checkUser, async function(
+router.get('/:projectId/monitor/:statusPageId', checkUser, async function (
req,
res
) {
@@ -1696,7 +1693,7 @@ router.get('/:projectId/monitor/:statusPageId', checkUser, async function(
router.post(
'/:projectId/createExternalstatus-page/:statusPageId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, statusPageId } = req.params;
const { name, url } = req.body;
@@ -1811,7 +1808,7 @@ router.post(
router.post(
'/:projectId/updateExternalstatus-page/:externalStatusPageId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, externalStatusPageId } = req.params;
const { name, url } = req.body;
@@ -1905,7 +1902,7 @@ router.post(
router.get(
'/:projectId/fetchExternalStatusPages/:statusPageId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, statusPageId } = req.params;
@@ -1939,7 +1936,7 @@ router.get(
router.post(
'/:projectId/deleteExternalstatus-page/:externalStatusPageId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, externalStatusPageId } = req.params;
@@ -1973,7 +1970,7 @@ router.post(
}
);
-router.post('/:projectId/announcement/:statusPageId', checkUser, async function(
+router.post('/:projectId/announcement/:statusPageId', checkUser, async function (
req,
res
) {
@@ -2025,7 +2022,7 @@ router.post('/:projectId/announcement/:statusPageId', checkUser, async function(
router.put(
'/:projectId/announcement/:statusPageId/:announcementId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, statusPageId, announcementId } = req.params;
const { data } = req.body;
@@ -2111,7 +2108,7 @@ router.put(
router.get(
'/:projectId/announcementLogs/:statusPageId',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageId } = req.params;
const { skip, limit, theme } = req.query;
@@ -2151,7 +2148,7 @@ router.get(
}
);
-router.get('/:projectId/announcement/:statusPageId', checkUser, async function(
+router.get('/:projectId/announcement/:statusPageId', checkUser, async function (
req,
res
) {
@@ -2181,7 +2178,7 @@ router.get('/:projectId/announcement/:statusPageId', checkUser, async function(
router.get(
'/:projectId/announcement/:statusPageSlug/single/:announcementSlug',
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, statusPageSlug, announcementSlug } = req.params;
@@ -2204,7 +2201,7 @@ router.get(
router.delete(
`/:projectId/announcement/:announcementId/delete`,
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { projectId, announcementId } = req.params;
@@ -2226,7 +2223,7 @@ router.delete(
router.delete(
`/:projectId/announcementLog/:announcementLogId/delete`,
checkUser,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { announcementLogId } = req.params;
@@ -2307,9 +2304,8 @@ function handleMonitorList(monitors: $TSFixMe) {
return `${monitors[0].monitorId.name}, ${monitors[1].monitorId.name} and ${monitors[2].monitorId.name}`;
}
if (monitors.length > 3) {
- return `${monitors[0].monitorId.name}, ${
- monitors[1].monitorId.name
- } and ${monitors.length - 2} others`;
+ return `${monitors[0].monitorId.name}, ${monitors[1].monitorId.name
+ } and ${monitors.length - 2} others`;
}
}
@@ -2317,7 +2313,7 @@ router.get(
'/resources/:statusPageSlug/ongoing-events',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2345,7 +2341,7 @@ router.get(
'/resources/:statusPageSlug/future-events',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2369,7 +2365,7 @@ router.get(
'/resources/:statusPageSlug/past-events',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2393,7 +2389,7 @@ router.get(
'/resources/:statusPageSlug/probes',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2417,7 +2413,7 @@ router.get(
'/resources/:statusPageSlug/monitor-logs',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2441,7 +2437,7 @@ router.get(
'/resources/:statusPageSlug/announcements',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2471,7 +2467,7 @@ router.get(
'/resources/:statusPageSlug/announcement-logs',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2495,7 +2491,7 @@ router.get(
'/resources/:statusPageSlug/monitor-timelines',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2519,7 +2515,7 @@ router.get(
'/resources/:statusPageSlug/statuspage-notes',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
@@ -2549,7 +2545,7 @@ router.get(
'/resources/:statusPageSlug/monitor-statuses',
checkUser,
ipWhitelist,
- async function(req: Request, res: Response) {
+ async function (req: Request, res: Response) {
try {
const { statusPageSlug } = req.params;
const { range } = req.query;
@@ -2591,7 +2587,7 @@ router.get(
}
);
-async function getStatusPage(req: $TSFixMe, statusPageSlug: $TSFixMe) {
+async function getStatusPage(req: Request, statusPageSlug: $TSFixMe) {
const url = req.query.url;
const user = req.user;
let statusPage = {};
@@ -2657,7 +2653,7 @@ async function getStatusPage(req: $TSFixMe, statusPageSlug: $TSFixMe) {
}
async function getOngoingScheduledEvents(
- req: $TSFixMe,
+ req: Request,
statusPageSlug: $TSFixMe
) {
const { skip = 0, limit = 5, theme = false } = req.query;
@@ -2678,7 +2674,7 @@ async function getOngoingScheduledEvents(
}
return { events, count };
}
-async function getFutureEvents(req: $TSFixMe, statusPageSlug: $TSFixMe) {
+async function getFutureEvents(req: Request, statusPageSlug: $TSFixMe) {
const { skip = 0, limit = 5, theme = false } = req.query;
const response = await StatusPageService.getFutureEvents(
{ slug: statusPageSlug },
@@ -2691,7 +2687,7 @@ async function getFutureEvents(req: $TSFixMe, statusPageSlug: $TSFixMe) {
}
return response;
}
-async function getPastEvents(req: $TSFixMe, statusPageSlug: $TSFixMe) {
+async function getPastEvents(req: Request, statusPageSlug: $TSFixMe) {
const { skip = 0, limit = 5, theme = false } = req.query;
const response = await StatusPageService.getPastEvents(
@@ -2721,7 +2717,7 @@ async function getProbes(req: $TSFixMe) {
const count = await ProbeService.countBy({});
return { probes, count };
}
-async function getMonitorLogs(req: $TSFixMe, monitors: $TSFixMe) {
+async function getMonitorLogs(req: Request, monitors: $TSFixMe) {
const logs: $TSFixMe = [];
await Promise.all(
monitors.map(async (monitor: $TSFixMe) => {
@@ -2775,7 +2771,7 @@ async function getMonitorLogs(req: $TSFixMe, monitors: $TSFixMe) {
}
async function getAnnouncements(
- req: $TSFixMe,
+ req: Request,
statusPageId: $TSFixMe,
projectId: $TSFixMe
) {
@@ -2800,7 +2796,7 @@ async function getAnnouncements(
};
}
//get monitor status
-async function getMonitorStatuses(req: $TSFixMe, monitors: $TSFixMe) {
+async function getMonitorStatuses(req: Request, monitors: $TSFixMe) {
const status = {};
const endDate = moment(Date.now());
const startDate = moment(Date.now()).subtract(90, 'days');
@@ -2829,7 +2825,7 @@ async function getMonitorTimelines(statusPageSlug: $TSFixMe) {
}
//get status page notes
async function getStatusPageNote(
- req: $TSFixMe,
+ req: Request,
statusPageSlug: $TSFixMe,
theme: $TSFixMe
) {
@@ -2957,18 +2953,18 @@ const filterProbeData = (
monitorStatuses && monitorStatuses.length > 0
? probe
? monitorStatuses.filter((probeStatuses: $TSFixMe) => {
- return (
- probeStatuses._id === null ||
- String(probeStatuses._id) === String(probe._id)
- );
- })
+ return (
+ probeStatuses._id === null ||
+ String(probeStatuses._id) === String(probe._id)
+ );
+ })
: monitorStatuses
: [];
const statuses =
probesStatus &&
- probesStatus[0] &&
- probesStatus[0].statuses &&
- probesStatus[0].statuses.length > 0
+ probesStatus[0] &&
+ probesStatus[0].statuses &&
+ probesStatus[0].statuses.length > 0
? probesStatus[0].statuses
: [];
diff --git a/backend/backend/services/teamService.ts b/backend/backend/services/teamService.ts
index d973946710..6fc1ffad35 100755
--- a/backend/backend/services/teamService.ts
+++ b/backend/backend/services/teamService.ts
@@ -4,7 +4,7 @@ export default {
//Param 1: projectId: Project id.
//Param 2: subProjectId: SubProject id
//Returns: list of team members
- getTeamMembersBy: async function(query: $TSFixMe) {
+ getTeamMembersBy: async function (query: $TSFixMe) {
let projectMembers: $TSFixMe = [];
const projects = await ProjectService.findBy({
@@ -65,7 +65,7 @@ export default {
return response;
},
- getTeamMemberBy: async function(
+ getTeamMemberBy: async function (
projectId: $TSFixMe,
teamMemberUserId: $TSFixMe
) {
@@ -120,7 +120,7 @@ export default {
}
},
- getSeats: async function(members: $TSFixMe) {
+ getSeats: async function (members: $TSFixMe) {
let seats = members.filter(async (user: $TSFixMe) => {
let count = 0;
const user_member = await UserService.findOneBy({
@@ -149,7 +149,7 @@ export default {
//Param 2: emails: Emails of new user added by Admin.
//Param 3: role: Role set by Admin.
//Returns: promise
- inviteTeamMembers: async function(
+ inviteTeamMembers: async function (
addedByUserId: $TSFixMe,
projectId: $TSFixMe,
emails: $TSFixMe,
@@ -165,7 +165,7 @@ export default {
//Checks if users to be added to project are not duplicate.
let duplicateEmail = false;
- emails.forEach(function(element: $TSFixMe, index: $TSFixMe) {
+ emails.forEach(function (element: $TSFixMe, index: $TSFixMe) {
// Find if there is a duplicate or not
if (emails.indexOf(element, index + 1) > -1) {
duplicateEmail = true;
@@ -255,7 +255,7 @@ export default {
//Params:
//Param 1: projectId: Project id.
//Returns: promise
- getTeamMembers: async function(projectId: $TSFixMe) {
+ getTeamMembers: async function (projectId: $TSFixMe) {
const _this = this;
const subProject = await ProjectService.findOneBy({
@@ -279,7 +279,7 @@ export default {
return [];
},
- isValidBusinessEmails: function(emails: $TSFixMe) {
+ isValidBusinessEmails: function (emails: $TSFixMe) {
let valid = true;
if (emails && emails.length > 0) {
for (let i = 0; i < emails.length; i++) {
@@ -323,7 +323,7 @@ export default {
//Param 4: addedBy: Admin who added the user.
//Param 5: project: Project.
//Returns: promise
- inviteTeamMembersMethod: async function(
+ inviteTeamMembersMethod: async function (
projectId: $TSFixMe,
emails: $TSFixMe,
role: $TSFixMe,
@@ -579,7 +579,7 @@ export default {
//Param 2: userId: User id of admin.
//Param 3: teamMemberUserId: Team Member Id of user to delete by Owner.
//Returns: promise
- removeTeamMember: async function(
+ removeTeamMember: async function (
projectId: $TSFixMe,
userId: $TSFixMe,
teamMemberUserId: $TSFixMe
@@ -767,7 +767,7 @@ export default {
//Param 3: teamMemberUserId: id of Team Member.
//Param 4: nextRole: Role of user to updated by Admin.
//Returns: promise
- updateTeamMemberRole: async function(
+ updateTeamMemberRole: async function (
projectId: $TSFixMe,
userId: $TSFixMe,
teamMemberUserId: $TSFixMe,
@@ -809,7 +809,7 @@ export default {
});
const prevTeams = subProjects
.concat(project)
- .map((res: $TSFixMe) => res.users);
+ .map((req: Response) => res.users);
const prevFlatTeams = flatten(prevTeams);
const prevTeamArr = prevFlatTeams.filter(
user => String(user.userId) === String(teamMemberUserId)
diff --git a/backend/backend/workers/iotMonitor.ts b/backend/backend/workers/iotMonitor.ts
index 3882ed590a..8be7e0584c 100755
--- a/backend/backend/workers/iotMonitor.ts
+++ b/backend/backend/workers/iotMonitor.ts
@@ -31,7 +31,7 @@ export default {
},
};
-const job = async (monitor: $TSFixMe, res: $TSFixMe) => {
+const job = async (monitor: $TSFixMe, req: Response) => {
try {
const populate = [
{
diff --git a/backend/test/adminCredentials.test.ts b/backend/test/adminCredentials.test.ts
index a004aa3faa..c6bf778c13 100644
--- a/backend/test/adminCredentials.test.ts
+++ b/backend/test/adminCredentials.test.ts
@@ -17,43 +17,43 @@ import AirtableService from '../backend/services/airtableService';
let token;
-describe('Admin process.env login API', function() {
+describe('Admin process.env login API', function () {
this.timeout(30000);
- before(async function() {
+ before(async function () {
this.timeout(40000);
await UserService.hardDeleteBy({});
await GlobalConfig.initTestConfig();
});
- after(async function() {
+ after(async function () {
await UserService.hardDeleteBy({});
await AirtableService.deleteAll({ tableName: 'User' });
await GlobalConfig.removeTestConfig();
await AuditLogsService.hardDeleteBy({});
});
- it('should NOT log in the admin user with invalid credentials', function(done: $TSFixMe) {
+ it('should NOT log in the admin user with invalid credentials', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: process.env.ADMIN_EMAIL,
password: process.env.ADMIN_PASSWORD + '1',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should log in the admin user', function(done: $TSFixMe) {
+ it('should log in the admin user', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: process.env.ADMIN_EMAIL,
password: process.env.ADMIN_PASSWORD,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
if (token) {
done();
diff --git a/backend/test/alert.test.ts b/backend/test/alert.test.ts
index 8f6bf4e0ff..ca909a8c7e 100644
--- a/backend/test/alert.test.ts
+++ b/backend/test/alert.test.ts
@@ -37,20 +37,20 @@ const monitor = {
data: { url: 'http://www.tests.org' },
};
-describe('Alert API', function() {
- after(async function() {
+describe('Alert API', function () {
+ after(async function () {
await UserService.hardDeleteBy({});
});
- describe('Alert API without subprojects', function() {
+ describe('Alert API without subprojects', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -61,16 +61,16 @@ describe('Alert API', function() {
UserModel.findByIdAndUpdate(
userId,
{ $set: { isVerified: true } },
- function() {
+ function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token =
res.body.tokens.jwtAccessToken;
@@ -85,9 +85,9 @@ describe('Alert API', function() {
...monitor,
componentId: component._id,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
incidentData.monitors = [
@@ -111,7 +111,7 @@ describe('Alert API', function() {
});
});
- after(async function() {
+ after(async function () {
await StatusPageService.hardDeleteBy({ projectId: projectId });
await NotificationService.hardDeleteBy({ projectId: projectId });
await AlertService.hardDeleteBy({ _id: alertId });
@@ -124,13 +124,13 @@ describe('Alert API', function() {
// 'post /:projectId'
- it('should register with valid projectId, monitorId, incidentId, alertVia', function(done: $TSFixMe) {
+ it('should register with valid projectId, monitorId, incidentId, alertVia', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/incident/${projectId}/create-incident`)
.set('Authorization', authorization)
.send(incidentData)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
incidentId = res.body._id;
monitorId = res.body.monitors[0].monitorId._id;
request
@@ -142,7 +142,7 @@ describe('Alert API', function() {
incidentId: incidentId,
eventType: 'identified',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
alertId = res.body._id;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -151,12 +151,12 @@ describe('Alert API', function() {
});
});
- it('should get an array of alerts by valid projectId', function(done: $TSFixMe) {
+ it('should get an array of alerts by valid projectId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/alert/${projectId}/alert`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -165,12 +165,12 @@ describe('Alert API', function() {
});
});
- it('should get an array alerts of by valid incidentId', function(done: $TSFixMe) {
+ it('should get an array alerts of by valid incidentId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/alert/${projectId}/incident/${incidentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -179,23 +179,23 @@ describe('Alert API', function() {
});
});
- it('should deleted alert', function(done: $TSFixMe) {
+ it('should deleted alert', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/alert/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should not delete alert with non-existing projectId', function(done: $TSFixMe) {
+ it('should not delete alert with non-existing projectId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete('/alert/5f71e52737c855f7c5b347d3')
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
@@ -204,39 +204,39 @@ describe('Alert API', function() {
let newUserToken: $TSFixMe;
- describe('Alert API with Sub-Projects', function() {
+ describe('Alert API with Sub-Projects', function () {
this.timeout(40000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
const authorization = `Basic ${token}`;
// create a subproject for parent project
- GlobalConfig.initTestConfig().then(function() {
+ GlobalConfig.initTestConfig().then(function () {
request
.post(`/project/${projectId}/subProject`)
.set('Authorization', authorization)
.send({ subProjectName: 'New SubProject' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectId = res.body[0]._id;
// sign up second user (subproject user)
- createUser(request, userData.newUser, function(
+ createUser(request, userData.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
UserModel.findByIdAndUpdate(
userId,
{ $set: { isVerified: true } },
- function() {
+ function () {
request
.post('/user/login')
.send({
email: userData.newUser.email,
password: userData.newUser.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
newUserToken =
res.body.tokens.jwtAccessToken;
@@ -253,7 +253,7 @@ describe('Alert API', function() {
userData.newUser.email,
role: 'Member',
})
- .end(function() {
+ .end(function () {
done();
});
});
@@ -264,7 +264,7 @@ describe('Alert API', function() {
});
});
- after(async function() {
+ after(async function () {
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, subProjectId] },
});
@@ -283,23 +283,23 @@ describe('Alert API', function() {
await GlobalConfig.removeTestConfig();
});
- it('should not create alert for user not in the project.', function(done: $TSFixMe) {
- createUser(request, userData.anotherUser, function(
+ it('should not create alert for user not in the project.', function (done: $TSFixMe) {
+ createUser(request, userData.anotherUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
UserModel.findByIdAndUpdate(
userId,
{ $set: { isVerified: true } },
- function() {
+ function () {
request
.post('/user/login')
.send({
email: userData.anotherUser.email,
password: userData.anotherUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
request
.post(`/alert/${projectId}`)
@@ -309,9 +309,9 @@ describe('Alert API', function() {
alertVia: 'email',
incidentId: incidentId,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
alertId = res.body._id;
expect(res).to.have.status(400);
@@ -326,7 +326,7 @@ describe('Alert API', function() {
});
});
- it('should create alert in parent project', function(done: $TSFixMe) {
+ it('should create alert in parent project', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/alert/${projectId}`)
@@ -337,7 +337,7 @@ describe('Alert API', function() {
incidentId: incidentId,
eventType: 'identified',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
alertId = res.body._id;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -345,7 +345,7 @@ describe('Alert API', function() {
});
});
- it('should create alert in sub-project', function(done: $TSFixMe) {
+ it('should create alert in sub-project', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.post(`/alert/${subProjectId}`)
@@ -356,19 +356,19 @@ describe('Alert API', function() {
incidentId: incidentId,
eventType: 'identified',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
});
});
- it('should get only sub-project alerts for valid user.', function(done: $TSFixMe) {
+ it('should get only sub-project alerts for valid user.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.get(`/alert/${subProjectId}/alert`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -377,12 +377,12 @@ describe('Alert API', function() {
});
});
- it('should get both project and sub-project alerts for valid user.', function(done: $TSFixMe) {
+ it('should get both project and sub-project alerts for valid user.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/alert/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body[0]).to.have.property('alerts');
@@ -393,23 +393,23 @@ describe('Alert API', function() {
});
});
- it('should delete sub-project alert', function(done: $TSFixMe) {
+ it('should delete sub-project alert', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/alert/${subProjectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should delete project alert', function(done: $TSFixMe) {
+ it('should delete project alert', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/alert/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
diff --git a/backend/test/applicationLog.test.ts b/backend/test/applicationLog.test.ts
index e40a0a01f5..fbfb6b630c 100644
--- a/backend/test/applicationLog.test.ts
+++ b/backend/test/applicationLog.test.ts
@@ -35,35 +35,35 @@ const logCount = {
warning: 0,
};
-describe('Application Log API', function() {
+describe('Application Log API', function () {
this.timeout(80000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(90000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
@@ -72,9 +72,9 @@ describe('Application Log API', function() {
.send({
name: 'New Component',
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
componentId = res.body._id;
expect(res).to.have.status(200);
@@ -90,19 +90,19 @@ describe('Application Log API', function() {
});
});
- it('should reject the request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject the request of an unauthenticated user', function (done: $TSFixMe) {
request
.post(`/application-log/${projectId}/${componentId}/create`)
.send({
name: 'New Application Log',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject the request of an empty application log name', function(done: $TSFixMe) {
+ it('should reject the request of an empty application log name', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/application-log/${projectId}/${componentId}/create`)
@@ -110,13 +110,13 @@ describe('Application Log API', function() {
.send({
name: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create the application log', function(done: $TSFixMe) {
+ it('should create the application log', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/application-log/${projectId}/${componentId}/create`)
@@ -124,7 +124,7 @@ describe('Application Log API', function() {
.send({
name: 'Travis Watcher',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
applicationLog = res.body;
expect(res).to.have.status(200);
expect(res.body).to.include({ name: 'Travis Watcher' });
@@ -132,24 +132,24 @@ describe('Application Log API', function() {
});
});
- it('should return a list of application logs under component', function(done: $TSFixMe) {
+ it('should return a list of application logs under component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/application-log/${projectId}/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.applicationLogs).to.be.an('array');
done();
});
});
- it('should not return a list of application logs under wrong component', function(done: $TSFixMe) {
+ it('should not return a list of application logs under wrong component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/application-log/${projectId}/5ee8d7cc8701d678901ab908`) // wrong component ID
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Component does not exist.'
@@ -158,13 +158,13 @@ describe('Application Log API', function() {
});
});
- it('should not create a log with wrong application key', function(done: $TSFixMe) {
+ it('should not create a log with wrong application key', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application Log does not exist.'
@@ -173,14 +173,14 @@ describe('Application Log API', function() {
});
});
- it('should create a log with correct application log key', function(done: $TSFixMe) {
+ it('should create a log with correct application log key', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
log.applicationLogKey = applicationLog.key;
request
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.include({ content: log.content });
expect(res.body).to.include({ type: log.type });
@@ -192,7 +192,7 @@ describe('Application Log API', function() {
});
});
- it('should create a log with correct application log key with type error', function(done: $TSFixMe) {
+ it('should create a log with correct application log key with type error', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
log.applicationLogKey = applicationLog.key;
log.type = 'error';
@@ -200,7 +200,7 @@ describe('Application Log API', function() {
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.include({ content: log.content });
expect(res.body).to.include({ type: log.type });
@@ -212,7 +212,7 @@ describe('Application Log API', function() {
});
});
- it('should create a log with correct application log key with type error and one tag', function(done: $TSFixMe) {
+ it('should create a log with correct application log key with type error and one tag', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
log.applicationLogKey = applicationLog.key;
log.type = 'error';
@@ -222,7 +222,7 @@ describe('Application Log API', function() {
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.include({ content: log.content });
expect(res.body).to.include({ type: log.type });
@@ -235,7 +235,7 @@ describe('Application Log API', function() {
});
});
- it('should not create a log with correct application log key with type error but invalid tag', function(done: $TSFixMe) {
+ it('should not create a log with correct application log key with type error but invalid tag', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
log.applicationLogKey = applicationLog.key;
log.type = 'error';
@@ -245,7 +245,7 @@ describe('Application Log API', function() {
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application Log Tags must be of type String or Array of Strings'
@@ -257,7 +257,7 @@ describe('Application Log API', function() {
});
});
- it('should create a log with correct application log key with type error and 5 tags', function(done: $TSFixMe) {
+ it('should create a log with correct application log key with type error and 5 tags', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
log.applicationLogKey = applicationLog.key;
log.type = 'error';
@@ -267,7 +267,7 @@ describe('Application Log API', function() {
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.include({ content: log.content });
expect(res.body).to.include({ type: log.type });
@@ -281,7 +281,7 @@ describe('Application Log API', function() {
});
});
- it('should fetch logs related to application log with tag search params', function(done: $TSFixMe) {
+ it('should fetch logs related to application log with tag search params', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
// create a log
log.applicationLogKey = applicationLog.key;
@@ -301,7 +301,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ filter: 'server' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('object');
expect(res.body.data.logs).to.be.an('array');
@@ -311,7 +311,7 @@ describe('Application Log API', function() {
});
});
- it('should not create a log with correct application log key and invalid type', function(done: $TSFixMe) {
+ it('should not create a log with correct application log key and invalid type', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
log.applicationLogKey = applicationLog.key;
log.type = 'any type';
@@ -319,7 +319,7 @@ describe('Application Log API', function() {
.post(`/application-log/${applicationLog._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Log Type must be of the allowed types.'
@@ -328,14 +328,14 @@ describe('Application Log API', function() {
});
});
- it('should not reset the application log key for wrong application log id', function(done: $TSFixMe) {
+ it('should not reset the application log key for wrong application log id', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/application-log/${projectId}/${componentId}/5ee8d7cc8701d678901ab908/reset-key`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(404);
expect(res.body.message).to.be.equal(
'Application Log not found'
@@ -346,14 +346,14 @@ describe('Application Log API', function() {
});
});
- it('should reset the application log key', function(done: $TSFixMe) {
+ it('should reset the application log key', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/application-log/${projectId}/${componentId}/${applicationLog._id}/reset-key`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
// confirm that the new key is not the same with the old key
expect(res.body.key).to.not.be.equal(applicationLog.key);
@@ -365,14 +365,14 @@ describe('Application Log API', function() {
});
});
- it('should fetch logs related to application log', function(done: $TSFixMe) {
+ it('should fetch logs related to application log', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/application-log/${projectId}/${componentId}/${applicationLog._id}/logs`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('object');
expect(res.body.data.logs).to.be.an('array');
@@ -384,7 +384,7 @@ describe('Application Log API', function() {
});
});
- it('should fetch logs related to application log with search params', function(done: $TSFixMe) {
+ it('should fetch logs related to application log with search params', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
// create a log
log.applicationLogKey = applicationLog.key;
@@ -402,7 +402,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ type: 'warning' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('object');
expect(res.body.data.logs).to.be.an('array');
@@ -412,7 +412,7 @@ describe('Application Log API', function() {
});
});
- it('should fetch logs related to application log with search params related to content', function(done: $TSFixMe) {
+ it('should fetch logs related to application log with search params related to content', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
// create a log
log.applicationLogKey = applicationLog.key;
@@ -431,7 +431,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ type: 'error' }) // filter by error
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('object');
expect(res.body.data.logs).to.be.an('array');
@@ -444,7 +444,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ type: 'error', filter: 'james' }) // filter by error and keyword from content
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('object');
expect(res.body.data.logs).to.be.an('array');
@@ -454,7 +454,7 @@ describe('Application Log API', function() {
});
});
- it('should fetch logs all log stat related to application log', function(done: $TSFixMe) {
+ it('should fetch logs all log stat related to application log', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
// create a log
log.applicationLogKey = applicationLog.key;
@@ -473,7 +473,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('object');
expect(res.body.data.all).to.be.equal(
@@ -486,7 +486,7 @@ describe('Application Log API', function() {
});
});
- it('should not edit an application log with empty name', function(done: $TSFixMe) {
+ it('should not edit an application log with empty name', function (done: $TSFixMe) {
const newName = '';
const authorization = `Basic ${token}`;
request
@@ -495,7 +495,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ name: newName })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'New Application Log Name is required.'
@@ -504,7 +504,7 @@ describe('Application Log API', function() {
});
});
- it('should not edit an application log with same name as existing application log', function(done: $TSFixMe) {
+ it('should not edit an application log with same name as existing application log', function (done: $TSFixMe) {
const newName = 'Astro';
const authorization = `Basic ${token}`;
request
@@ -513,7 +513,7 @@ describe('Application Log API', function() {
.send({
name: newName,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
applicationLog = res.body;
expect(res).to.have.status(200);
expect(res.body).to.include({ name: newName });
@@ -523,7 +523,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ name: newName })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application Log with that name already exists.'
@@ -533,7 +533,7 @@ describe('Application Log API', function() {
});
});
- it('should edit an application log', function(done: $TSFixMe) {
+ it('should edit an application log', function (done: $TSFixMe) {
const newName = 'Rodeo';
const authorization = `Basic ${token}`;
request
@@ -542,7 +542,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ name: newName })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.id).to.be.equal(applicationLog.id);
expect(res.body.name).to.be.equal(newName);
@@ -550,7 +550,7 @@ describe('Application Log API', function() {
});
});
- it('should edit an application log but not change application log key', function(done: $TSFixMe) {
+ it('should edit an application log but not change application log key', function (done: $TSFixMe) {
const newName = 'Rodeo II';
const authorization = `Basic ${token}`;
request
@@ -559,7 +559,7 @@ describe('Application Log API', function() {
)
.set('Authorization', authorization)
.send({ name: newName })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.id).to.be.equal(applicationLog.id);
expect(res.body.name).to.be.equal(newName);
@@ -568,14 +568,14 @@ describe('Application Log API', function() {
});
});
- it('should delete an application log', function(done: $TSFixMe) {
+ it('should delete an application log', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(
`/application-log/${projectId}/${componentId}/${applicationLog._id}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.id).to.be.equal(applicationLog.id);
expect(res.body.deleted).to.be.equal(true);
@@ -585,7 +585,7 @@ describe('Application Log API', function() {
// Yet to figure out how thi works
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await ApplicationLogService.hardDeleteBy({
diff --git a/backend/test/applicationSecurity.test.ts b/backend/test/applicationSecurity.test.ts
index e807a0a3dc..4764897252 100644
--- a/backend/test/applicationSecurity.test.ts
+++ b/backend/test/applicationSecurity.test.ts
@@ -22,7 +22,7 @@ import ApplicationSecurities from '../backend/services/applicationSecurityServic
import ApplicationSecurityLogService from '../backend/services/applicationSecurityLogService';
import AirtableService from '../backend/services/airtableService';
-describe('Application Security API', function() {
+describe('Application Security API', function () {
const timeout = 300000;
let projectId: $TSFixMe,
componentId: $TSFixMe,
@@ -33,11 +33,11 @@ describe('Application Security API', function() {
this.timeout(timeout);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -46,8 +46,8 @@ describe('Application Security API', function() {
UserService.updateOneBy(
{ _id: userId },
{ role: 'master-admin' }
- ).then(function() {
- VerificationTokenModel.findOne({ userId }, function(
+ ).then(function () {
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -56,16 +56,16 @@ describe('Application Security API', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
@@ -74,9 +74,9 @@ describe('Application Security API', function() {
.post(`/component/${projectId}`)
.set('Authorization', authorization)
.send({ name: 'newComponent' })
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
componentId = res.body._id;
done();
@@ -89,7 +89,7 @@ describe('Application Security API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -102,14 +102,14 @@ describe('Application Security API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should create an application security', function(done: $TSFixMe) {
+ it('should create an application security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
GitCredentialService.create({
gitUsername: gitCredential.gitUsername,
gitPassword: gitCredential.gitPassword,
projectId,
- }).then(function(credential) {
+ }).then(function (credential) {
credentialId = credential._id;
const data = {
name: 'Test',
@@ -122,7 +122,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
applicationSecurityId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.componentId).to.be.equal(componentId);
@@ -138,7 +138,7 @@ describe('Application Security API', function() {
});
});
- it('should update an application security', function(done: $TSFixMe) {
+ it('should update an application security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const update = { name: 'newname' };
@@ -148,14 +148,14 @@ describe('Application Security API', function() {
)
.set('Authorization', authorization)
.send(update)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(update.name);
done();
});
});
- it('should get a particular application security in a component', function(done: $TSFixMe) {
+ it('should get a particular application security in a component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -163,7 +163,7 @@ describe('Application Security API', function() {
`/security/${projectId}/${componentId}/application/${applicationSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(String(res.body._id)).to.be.equal(
String(applicationSecurityId)
@@ -175,33 +175,33 @@ describe('Application Security API', function() {
});
});
- it('should get all the application security in a component', function(done: $TSFixMe) {
+ it('should get all the application security in a component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
});
});
- it('should get all the application security with a particular credential', function(done: $TSFixMe) {
+ it('should get all the application security with a particular credential', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/security/${projectId}/application/${credentialId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
});
});
- it('should scan an application security', function(done: $TSFixMe) {
+ it('should scan an application security', function (done: $TSFixMe) {
this.timeout(300000);
const authorization = `Basic ${token}`;
@@ -210,13 +210,13 @@ describe('Application Security API', function() {
`/security/${projectId}/application/scan/${applicationSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should not create an application security if name already exist in the component', function(done: $TSFixMe) {
+ it('should not create an application security if name already exist in the component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
@@ -229,7 +229,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application security with this name already exist in this component'
@@ -238,7 +238,7 @@ describe('Application Security API', function() {
});
});
- it('should not create an application security if git repository url already exist in the component', function(done: $TSFixMe) {
+ it('should not create an application security if git repository url already exist in the component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
@@ -251,7 +251,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application security with this git repository url already exist in this component'
@@ -260,7 +260,7 @@ describe('Application Security API', function() {
});
});
- it('should delete a particular application security', function(done: $TSFixMe) {
+ it('should delete a particular application security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -268,14 +268,14 @@ describe('Application Security API', function() {
`/security/${projectId}/${componentId}/application/${applicationSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.deleted).to.be.true;
done();
});
});
- it('should not create an application security if name is missing', function(done: $TSFixMe) {
+ it('should not create an application security if name is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
@@ -288,7 +288,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application Security Name is required'
@@ -297,7 +297,7 @@ describe('Application Security API', function() {
});
});
- it('should not create an application security if git repository url is missing', function(done: $TSFixMe) {
+ it('should not create an application security if git repository url is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
@@ -310,7 +310,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Git Repository URL is required'
@@ -319,7 +319,7 @@ describe('Application Security API', function() {
});
});
- it('should not create an application security if git credential is missing', function(done: $TSFixMe) {
+ it('should not create an application security if git credential is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
@@ -332,7 +332,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Git Credential is required'
@@ -341,7 +341,7 @@ describe('Application Security API', function() {
});
});
- it('should not scan an application security if it does not exist', function(done: $TSFixMe) {
+ it('should not scan an application security if it does not exist', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const applicationSecurityId = '5e8db9752cc46e3a229ebc51'; // non-existing ObjectId
@@ -350,7 +350,7 @@ describe('Application Security API', function() {
`/security/${projectId}/application/scan/${applicationSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application Security not found or does not exist'
@@ -359,7 +359,7 @@ describe('Application Security API', function() {
});
});
- it('should not delete a non-existing application security', function(done: $TSFixMe) {
+ it('should not delete a non-existing application security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const applicationSecurityId = '5e8db9752cc46e3a229ebc51'; // non-existing ObjectId
@@ -368,7 +368,7 @@ describe('Application Security API', function() {
`/security/${projectId}/${componentId}/application/${applicationSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application Security not found or does not exist'
@@ -377,7 +377,7 @@ describe('Application Security API', function() {
});
});
- it('should not get a non-existing application security', function(done: $TSFixMe) {
+ it('should not get a non-existing application security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const applicationSecurityId = '5e8db9752cc46e3a229ebc51'; // non-existing ObjectId
@@ -386,7 +386,7 @@ describe('Application Security API', function() {
`/security/${projectId}/${componentId}/application/${applicationSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Application security not found or does not exist'
@@ -395,7 +395,7 @@ describe('Application Security API', function() {
});
});
- it('should not create an application security if git credential does not exist', function(done: $TSFixMe) {
+ it('should not create an application security if git credential does not exist', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
@@ -408,7 +408,7 @@ describe('Application Security API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Git Credential not found or does not exist'
diff --git a/backend/test/auditLogs.test.ts b/backend/test/auditLogs.test.ts
index 49821a4e98..de53d3dee8 100644
--- a/backend/test/auditLogs.test.ts
+++ b/backend/test/auditLogs.test.ts
@@ -20,36 +20,36 @@ import VerificationTokenModel from '../backend/models/verificationToken';
let token: $TSFixMe, projectId: $TSFixMe, userId: $TSFixMe;
let testSuiteStartTime: $TSFixMe, testCaseStartTime: $TSFixMe;
-describe('Audit Logs API', function() {
+describe('Audit Logs API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
testSuiteStartTime = new Date();
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -59,7 +59,7 @@ describe('Audit Logs API', function() {
});
});
- after(async function() {
+ after(async function () {
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
email: {
@@ -89,11 +89,11 @@ describe('Audit Logs API', function() {
await AuditLogsService.hardDeleteBy({ query: deleteQuery });
});
- beforeEach(async function() {
+ beforeEach(async function () {
testCaseStartTime = new Date();
});
- afterEach(async function() {
+ afterEach(async function () {
// Deleting any auditLogs created between each test case in this suite.
// Note that using timeStamp between this test suite to remove some logs, Beacuse some audit logs dont contain specific 'userId'. (Ex. /login)
const deleteQuery = {
@@ -112,25 +112,25 @@ describe('Audit Logs API', function() {
});
});
- it('should reject get audit logs request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject get audit logs request of an unauthenticated user', function (done: $TSFixMe) {
request
.get('/audit-logs')
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject get audit logs request of NON master-admin user', function(done: $TSFixMe) {
- createUser(request, userData.newUser, function() {
+ it('should reject get audit logs request of NON master-admin user', function (done: $TSFixMe) {
+ createUser(request, userData.newUser, function () {
request
.post('/user/login')
.send({
email: userData.newUser.email,
password: userData.newUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
@@ -138,7 +138,7 @@ describe('Audit Logs API', function() {
.get('/audit-logs/')
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
@@ -146,7 +146,7 @@ describe('Audit Logs API', function() {
});
});
- it('should send get audit logs data for master-admin user', async function() {
+ it('should send get audit logs data for master-admin user', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -163,7 +163,7 @@ describe('Audit Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should send appopriate data set when limit is provided', async function() {
+ it('should send appopriate data set when limit is provided', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -187,7 +187,7 @@ describe('Audit Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should send appopriate data set when skip is provided', async function() {
+ it('should send appopriate data set when skip is provided', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -213,17 +213,17 @@ describe('Audit Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should reject search request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject search request of an unauthenticated user', function (done: $TSFixMe) {
request
.post('/audit-logs/search')
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject search request of NON master-admin user', async function() {
+ it('should reject search request of NON master-admin user', async function () {
await UserService.updateBy({ _id: userId }, { role: 'user' }); // Resetting user to normal USER.
const authorization = `Basic ${token}`;
@@ -237,7 +237,7 @@ describe('Audit Logs API', function() {
}
});
- it('should send Searched AuditLogs data for master-admin user', async function() {
+ it('should send Searched AuditLogs data for master-admin user', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -254,7 +254,7 @@ describe('Audit Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should send only matched result to provided search string when searched.', async function() {
+ it('should send only matched result to provided search string when searched.', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
diff --git a/backend/test/component.test.ts b/backend/test/component.test.ts
index e7357e8a42..4d13d7486c 100644
--- a/backend/test/component.test.ts
+++ b/backend/test/component.test.ts
@@ -31,35 +31,35 @@ let token: $TSFixMe,
monitorId: $TSFixMe,
resourceCount = 0;
-describe('Component API', function() {
+describe('Component API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(80000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -69,19 +69,19 @@ describe('Component API', function() {
});
});
- it('should reject the request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject the request of an unauthenticated user', function (done: $TSFixMe) {
request
.post(`/component/${projectId}`)
.send({
name: 'New Component',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should not create a component when the `name` field is null', function(done: $TSFixMe) {
+ it('should not create a component when the `name` field is null', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/component/${projectId}`)
@@ -89,13 +89,13 @@ describe('Component API', function() {
.send({
name: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create a new component when the correct data is given by an authenticated user', function(done: $TSFixMe) {
+ it('should create a new component when the correct data is given by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/component/${projectId}`)
@@ -103,7 +103,7 @@ describe('Component API', function() {
.send({
name: 'New Component',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
componentId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Component');
@@ -111,7 +111,7 @@ describe('Component API', function() {
});
});
- it('should update a component when the correct data is given by an authenticated user', function(done: $TSFixMe) {
+ it('should update a component when the correct data is given by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/component/${projectId}/${componentId}`)
@@ -119,19 +119,19 @@ describe('Component API', function() {
.send({
name: 'Updated Component',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(componentId);
done();
});
});
- it('should get components for an authenticated user by ProjectId', function(done: $TSFixMe) {
+ it('should get components for an authenticated user by ProjectId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/component/${projectId}/component`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -140,12 +140,12 @@ describe('Component API', function() {
});
});
- it('should get a component for an authenticated user with valid componentId', function(done: $TSFixMe) {
+ it('should get a component for an authenticated user with valid componentId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/component/${projectId}/component/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body._id).to.be.equal(componentId);
@@ -153,7 +153,7 @@ describe('Component API', function() {
});
});
- it('should create a new monitor when `componentId` is given`', function(done: $TSFixMe) {
+ it('should create a new monitor when `componentId` is given`', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -164,7 +164,7 @@ describe('Component API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor');
@@ -173,12 +173,12 @@ describe('Component API', function() {
});
});
- it('should return a list of all resources under component', function(done: $TSFixMe) {
+ it('should return a list of all resources under component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/component/${projectId}/resources/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.totalResources).to.be.an('array');
expect(res.body.totalResources[0].type).to.be.a('string'); // type of the monitor
@@ -187,7 +187,7 @@ describe('Component API', function() {
});
});
- it('should create a new application log when `componentId` is given then get list of resources`', function(done: $TSFixMe) {
+ it('should create a new application log when `componentId` is given then get list of resources`', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/application-log/${projectId}/${componentId}/create`)
@@ -195,14 +195,14 @@ describe('Component API', function() {
.send({
name: 'New Application Log',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Application Log');
resourceCount++; // Increment Resource Count
request
.get(`/component/${projectId}/resources/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.totalResources).to.be.an('array');
expect(res.body.totalResources[1].status).to.be.a(
@@ -219,7 +219,7 @@ describe('Component API', function() {
});
});
- it('should create a new application log then creater a log when `componentId` is given then get list of resources`', function(done: $TSFixMe) {
+ it('should create a new application log then creater a log when `componentId` is given then get list of resources`', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/application-log/${projectId}/${componentId}/create`)
@@ -227,7 +227,7 @@ describe('Component API', function() {
.send({
name: 'New Application Log II',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
resourceCount++; // Increment Resource Count
expect(res.body.name).to.be.equal('New Application Log II');
@@ -240,7 +240,7 @@ describe('Component API', function() {
.post(`/application-log/${res.body._id}/log`)
.set('Authorization', authorization)
.send(log)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
request
@@ -248,7 +248,7 @@ describe('Component API', function() {
`/component/${projectId}/resources/${componentId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.totalResources).to.be.an(
'array'
@@ -268,14 +268,14 @@ describe('Component API', function() {
});
});
- it('should create an application security then get list of resources', function(done: $TSFixMe) {
+ it('should create an application security then get list of resources', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
GitCredentialService.create({
gitUsername: gitCredential.gitUsername,
gitPassword: gitCredential.gitPassword,
projectId,
- }).then(function(credential) {
+ }).then(function (credential) {
const data = {
name: 'Test',
gitRepositoryUrl: gitCredential.gitRepositoryUrl,
@@ -287,7 +287,7 @@ describe('Component API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
resourceCount++; // Increment Resource Count
expect(res.body.componentId).to.be.equal(componentId);
@@ -301,7 +301,7 @@ describe('Component API', function() {
request
.get(`/component/${projectId}/resources/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.totalResources).to.be.an('array');
expect(res.body.totalResources).to.have.lengthOf(
@@ -313,7 +313,7 @@ describe('Component API', function() {
});
});
- it('should create a container security', function(done: $TSFixMe) {
+ it('should create a container security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
DockerCredentialService.create({
@@ -321,7 +321,7 @@ describe('Component API', function() {
dockerPassword: dockerCredential.dockerPassword,
dockerRegistryUrl: dockerCredential.dockerRegistryUrl,
projectId,
- }).then(function(credential) {
+ }).then(function (credential) {
const data = {
name: 'Test Container',
dockerCredential: credential._id,
@@ -333,7 +333,7 @@ describe('Component API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
resourceCount++; // Increment Resource Count
expect(res.body.componentId).to.be.equal(componentId);
@@ -343,7 +343,7 @@ describe('Component API', function() {
request
.get(`/component/${projectId}/resources/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.totalResources).to.be.an('array');
expect(res.body.totalResources).to.have.lengthOf(
@@ -355,17 +355,17 @@ describe('Component API', function() {
});
});
- it('should delete a component and its monitor when componentId is valid', function(done: $TSFixMe) {
+ it('should delete a component and its monitor when componentId is valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/component/${projectId}/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
request
.get(`/monitor/${projectId}/monitor/${monitorId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body).to.be.an('object');
expect(res.body).to.not.have.property('_id');
done();
@@ -384,24 +384,24 @@ let subProjectId: $TSFixMe,
subProjectComponentId: $TSFixMe,
newComponentId: $TSFixMe;
-describe('Component API with Sub-Projects', function() {
+describe('Component API with Sub-Projects', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
const authorization = `Basic ${token}`;
// create a subproject for parent project
- GlobalConfig.initTestConfig().then(function() {
+ GlobalConfig.initTestConfig().then(function () {
request
.post(`/project/${projectId}/subProject`)
.set('Authorization', authorization)
.send({ subProjectName: 'New SubProject' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectId = res.body[0]._id;
// sign up second user (subproject user)
- createUser(request, userData.newUser, function(
+ createUser(request, userData.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
newProjectId = project._id;
@@ -409,7 +409,7 @@ describe('Component API with Sub-Projects', function() {
VerificationTokenModel.findOne(
{ userId: newUserId },
- function(
+ function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -418,7 +418,7 @@ describe('Component API with Sub-Projects', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
@@ -426,9 +426,9 @@ describe('Component API with Sub-Projects', function() {
password:
userData.newUser.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
newUserToken =
res.body.tokens
@@ -449,7 +449,7 @@ describe('Component API with Sub-Projects', function() {
.email,
role: 'Member',
})
- .end(function() {
+ .end(function () {
done();
});
});
@@ -461,7 +461,7 @@ describe('Component API with Sub-Projects', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: {
@@ -488,38 +488,38 @@ describe('Component API with Sub-Projects', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should not create a component for user not present in project', function(done: $TSFixMe) {
- createUser(request, userData.anotherUser, function(
+ it('should not create a component for user not present in project', function (done: $TSFixMe) {
+ createUser(request, userData.anotherUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
otherProjectId = project._id;
otherUserId = res.body.id;
- VerificationTokenModel.findOne({ userId: otherUserId }, function(
+ VerificationTokenModel.findOne({ userId: otherUserId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.anotherUser.email,
password: userData.anotherUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
request
.post(`/component/${projectId}`)
.set('Authorization', authorization)
.send({ name: 'New Component 1' })
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -533,7 +533,7 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should not create a component for user that is not `admin` in project.', function(done: $TSFixMe) {
+ it('should not create a component for user that is not `admin` in project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.post(`/component/${subProjectId}`)
@@ -541,7 +541,7 @@ describe('Component API with Sub-Projects', function() {
.send({
name: 'New Component 1',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You cannot edit the project because you're not an admin."
@@ -550,7 +550,7 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should create a component in parent project by valid admin.', function(done: $TSFixMe) {
+ it('should create a component in parent project by valid admin.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/component/${projectId}`)
@@ -558,7 +558,7 @@ describe('Component API with Sub-Projects', function() {
.send({
name: 'New Component 1',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
newComponentId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Component 1');
@@ -566,7 +566,7 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should not create a component with exisiting name in sub-project.', function(done: $TSFixMe) {
+ it('should not create a component with exisiting name in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/component/${subProjectId}`)
@@ -574,7 +574,7 @@ describe('Component API with Sub-Projects', function() {
.send({
name: 'New Component 1',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Component with that name already exists.'
@@ -583,7 +583,7 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should create a component in sub-project.', function(done: $TSFixMe) {
+ it('should create a component in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/component/${subProjectId}`)
@@ -591,7 +591,7 @@ describe('Component API with Sub-Projects', function() {
.send({
name: 'New Component 2',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectComponentId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Component 2');
@@ -599,12 +599,12 @@ describe('Component API with Sub-Projects', function() {
});
});
- it("should get only sub-project's components for valid sub-project user", function(done: $TSFixMe) {
+ it("should get only sub-project's components for valid sub-project user", function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.get(`/component/${subProjectId}/component`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -615,12 +615,12 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should get project components for valid parent project user.', function(done: $TSFixMe) {
+ it('should get project components for valid parent project user.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/component/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body[0]).to.have.property('components');
@@ -630,12 +630,12 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should get sub-project components for valid parent project user.', function(done: $TSFixMe) {
+ it('should get sub-project components for valid parent project user.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/component/${subProjectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body[0]).to.have.property('components');
@@ -645,12 +645,12 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should not delete a component for user that is not `admin` in sub-project.', function(done: $TSFixMe) {
+ it('should not delete a component for user that is not `admin` in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.delete(`/component/${subProjectId}/${subProjectComponentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You cannot edit the project because you're not an admin."
@@ -659,23 +659,23 @@ describe('Component API with Sub-Projects', function() {
});
});
- it('should delete sub-project component', function(done: $TSFixMe) {
+ it('should delete sub-project component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/component/${subProjectId}/${subProjectComponentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should delete project component', function(done: $TSFixMe) {
+ it('should delete project component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/component/${projectId}/${newComponentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
diff --git a/backend/test/containerSecurity.test.ts b/backend/test/containerSecurity.test.ts
index 874c462171..4b675cfdf8 100644
--- a/backend/test/containerSecurity.test.ts
+++ b/backend/test/containerSecurity.test.ts
@@ -22,7 +22,7 @@ import ContainerSecurityService from '../backend/services/containerSecurityServi
import ContainerSecurityLogService from '../backend/services/containerSecurityLogService';
import AirtableService from '../backend/services/airtableService';
-describe('Container Security API', function() {
+describe('Container Security API', function () {
const timeout = 30000;
let projectId: $TSFixMe,
componentId: $TSFixMe,
@@ -33,11 +33,11 @@ describe('Container Security API', function() {
this.timeout(timeout);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -46,8 +46,8 @@ describe('Container Security API', function() {
UserService.updateOneBy(
{ _id: userId },
{ role: 'master-admin' }
- ).then(function() {
- VerificationTokenModel.findOne({ userId }, function(
+ ).then(function () {
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -56,16 +56,16 @@ describe('Container Security API', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
@@ -74,9 +74,9 @@ describe('Container Security API', function() {
.post(`/component/${projectId}`)
.set('Authorization', authorization)
.send({ name: 'Test Component' })
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
componentId = res.body._id;
done();
@@ -89,7 +89,7 @@ describe('Container Security API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -102,7 +102,7 @@ describe('Container Security API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should create a container security', function(done: $TSFixMe) {
+ it('should create a container security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
DockerCredentialService.create({
@@ -110,7 +110,7 @@ describe('Container Security API', function() {
dockerPassword: dockerCredential.dockerPassword,
dockerRegistryUrl: dockerCredential.dockerRegistryUrl,
projectId,
- }).then(function(credential) {
+ }).then(function (credential) {
credentialId = credential._id;
const data = {
name: 'Test Container',
@@ -123,7 +123,7 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
containerSecurityId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.componentId).to.be.equal(componentId);
@@ -135,7 +135,7 @@ describe('Container Security API', function() {
});
});
- it('should update a container security', function(done: $TSFixMe) {
+ it('should update a container security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const update = { name: 'Container Test' };
@@ -145,14 +145,14 @@ describe('Container Security API', function() {
)
.set('Authorization', authorization)
.send(update)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(update.name);
done();
});
});
- it('should get a particular container security in a component', function(done: $TSFixMe) {
+ it('should get a particular container security in a component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -160,7 +160,7 @@ describe('Container Security API', function() {
`/security/${projectId}/${componentId}/container/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(String(res.body._id)).to.be.equal(
String(containerSecurityId)
@@ -172,33 +172,33 @@ describe('Container Security API', function() {
});
});
- it('should get all the container security in a component', function(done: $TSFixMe) {
+ it('should get all the container security in a component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
});
});
- it('should get all the container security with a particular credential', function(done: $TSFixMe) {
+ it('should get all the container security with a particular credential', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/security/${projectId}/container/${credentialId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
});
});
- it('should scan a container security', function(done: $TSFixMe) {
+ it('should scan a container security', function (done: $TSFixMe) {
this.timeout(300000);
const authorization = `Basic ${token}`;
@@ -207,13 +207,13 @@ describe('Container Security API', function() {
`/security/${projectId}/container/scan/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should throw error if scanning with an invalid docker credentials or invalid image path', function(done: $TSFixMe) {
+ it('should throw error if scanning with an invalid docker credentials or invalid image path', function (done: $TSFixMe) {
this.timeout(500000);
const authorization = `Basic ${token}`;
const data = {
@@ -227,14 +227,14 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const containerSecurityId = res.body._id;
request
.post(
`/security/${projectId}/container/scan/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Scanning failed please check your docker credential or image path/tag'
@@ -244,7 +244,7 @@ describe('Container Security API', function() {
});
});
- it('should not create a container security if name already exist in the component', function(done: $TSFixMe) {
+ it('should not create a container security if name already exist in the component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
name: 'Container Test',
@@ -257,7 +257,7 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Container security with this name already exist in this component'
@@ -266,7 +266,7 @@ describe('Container Security API', function() {
});
});
- it('should not create a container security if image path already exist in the component', function(done: $TSFixMe) {
+ it('should not create a container security if image path already exist in the component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
name: 'Another Container',
@@ -279,7 +279,7 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Container security with this image path already exist in this component'
@@ -288,7 +288,7 @@ describe('Container Security API', function() {
});
});
- it('should not create a container security if name is missing or undefined in the request body', function(done: $TSFixMe) {
+ it('should not create a container security if name is missing or undefined in the request body', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
dockerCredential: credentialId,
@@ -300,7 +300,7 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Container Security Name is required'
@@ -309,7 +309,7 @@ describe('Container Security API', function() {
});
});
- it('should not create a container security if image path is missing or undefined in the request body', function(done: $TSFixMe) {
+ it('should not create a container security if image path is missing or undefined in the request body', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
name: 'Another Container',
@@ -321,14 +321,14 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Image Path is required');
done();
});
});
- it('should not create a container security if dockerCredential is missing or undefined in the request body', function(done: $TSFixMe) {
+ it('should not create a container security if dockerCredential is missing or undefined in the request body', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
name: 'Another Container',
@@ -340,7 +340,7 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Docker Credential is required'
@@ -349,7 +349,7 @@ describe('Container Security API', function() {
});
});
- it('should delete a particular container security', function(done: $TSFixMe) {
+ it('should delete a particular container security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -357,14 +357,14 @@ describe('Container Security API', function() {
`/security/${projectId}/${componentId}/container/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.deleted).to.be.true;
done();
});
});
- it('should not scan a container security if it does not exist', function(done: $TSFixMe) {
+ it('should not scan a container security if it does not exist', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const containerSecurityId = '5e8db9752cc46e3a229ebc51'; // non-existing ObjectId
@@ -373,7 +373,7 @@ describe('Container Security API', function() {
`/security/${projectId}/container/scan/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Container Security not found or does not exist'
@@ -382,7 +382,7 @@ describe('Container Security API', function() {
});
});
- it('should not delete a non-existing container security', function(done: $TSFixMe) {
+ it('should not delete a non-existing container security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const containerSecurityId = '5e8db9752cc46e3a229ebc51'; // non-existing ObjectId
@@ -391,7 +391,7 @@ describe('Container Security API', function() {
`/security/${projectId}/${componentId}/container/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Container Security not found or does not exist'
@@ -400,7 +400,7 @@ describe('Container Security API', function() {
});
});
- it('should not get a non-existing container security', function(done: $TSFixMe) {
+ it('should not get a non-existing container security', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const containerSecurityId = '5e8db9752cc46e3a229ebc51'; // non-existing ObjectId
@@ -409,7 +409,7 @@ describe('Container Security API', function() {
`/security/${projectId}/${componentId}/container/${containerSecurityId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Container security not found or does not exist'
@@ -418,7 +418,7 @@ describe('Container Security API', function() {
});
});
- it('should not create a container security if dockerCredential does not exist', function(done: $TSFixMe) {
+ it('should not create a container security if dockerCredential does not exist', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
name: 'Another Container',
@@ -431,7 +431,7 @@ describe('Container Security API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Docker Credential not found or does not exist'
diff --git a/backend/test/customField.test.ts b/backend/test/customField.test.ts
index be022bffdd..8d34fb6395 100644
--- a/backend/test/customField.test.ts
+++ b/backend/test/customField.test.ts
@@ -19,7 +19,7 @@ import ProjectService from '../backend/services/projectService';
import ComponentService from '../backend/services/componentService';
import IncidentCustomFieldService from '../backend/services/customFieldService';
-describe('Incident Custom Field API', function() {
+describe('Incident Custom Field API', function () {
const timeout = 30000;
let projectId: $TSFixMe,
userId,
@@ -28,9 +28,9 @@ describe('Incident Custom Field API', function() {
customFieldId: $TSFixMe;
const incidentFieldText = {
- fieldName: 'inTextField',
- fieldType: 'text',
- },
+ fieldName: 'inTextField',
+ fieldType: 'text',
+ },
incidentFieldNumber = {
fieldName: 'inNumField',
fieldType: 'number',
@@ -38,31 +38,31 @@ describe('Incident Custom Field API', function() {
this.timeout(timeout);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
authorization = `Basic ${token}`;
done();
@@ -73,7 +73,7 @@ describe('Incident Custom Field API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -84,36 +84,36 @@ describe('Incident Custom Field API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should not create an incident custom field when field name is missing or not specified', function(done: $TSFixMe) {
+ it('should not create an incident custom field when field name is missing or not specified', function (done: $TSFixMe) {
request
.post(`/customField/${projectId}`)
.send({ fieldType: 'text' })
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Field name is required');
done();
});
});
- it('should not create an incident custom field when field type is missing or not specified', function(done: $TSFixMe) {
+ it('should not create an incident custom field when field type is missing or not specified', function (done: $TSFixMe) {
request
.post(`/customField/${projectId}`)
.send({ fieldName: 'missingType' })
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Field type is required');
done();
});
});
- it('should setup custom fields for all incidents in a project (text)', function(done: $TSFixMe) {
+ it('should setup custom fields for all incidents in a project (text)', function (done: $TSFixMe) {
request
.post(`/customField/${projectId}`)
.send(incidentFieldText)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
customFieldId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.fieldName).to.be.equal(
@@ -123,12 +123,12 @@ describe('Incident Custom Field API', function() {
});
});
- it('should not create incident custom field with an existing name in a project', function(done: $TSFixMe) {
+ it('should not create incident custom field with an existing name in a project', function (done: $TSFixMe) {
request
.post(`/customField/${projectId}`)
.send(incidentFieldText)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Custom field with this name already exist'
@@ -137,14 +137,14 @@ describe('Incident Custom Field API', function() {
});
});
- it('should update a particular incident custom field in a project', function(done: $TSFixMe) {
+ it('should update a particular incident custom field in a project', function (done: $TSFixMe) {
incidentFieldText.fieldName = 'newName';
request
.put(`/customField/${projectId}/${customFieldId}`)
.send(incidentFieldText)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.fieldName).to.be.equal(
incidentFieldText.fieldName
@@ -154,17 +154,17 @@ describe('Incident Custom Field API', function() {
});
});
- it('should list all the incident custom fields in a project', function(done: $TSFixMe) {
+ it('should list all the incident custom fields in a project', function (done: $TSFixMe) {
// add one more monitor custom field
request
.post(`/customField/${projectId}`)
.send(incidentFieldNumber)
.set('Authorization', authorization)
- .end(function() {
+ .end(function () {
request
.get(`/customField/${projectId}?skip=0&limit=10`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.count).to.be.equal(2);
expect(res.body.data).to.be.an('array');
@@ -173,11 +173,11 @@ describe('Incident Custom Field API', function() {
});
});
- it('should delete a particular monitor custom field in a project', function(done: $TSFixMe) {
+ it('should delete a particular monitor custom field in a project', function (done: $TSFixMe) {
request
.delete(`/customField/${projectId}/${customFieldId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(String(res.body._id)).to.be.equal(String(customFieldId));
done();
diff --git a/backend/test/emailAuthorization.test.ts b/backend/test/emailAuthorization.test.ts
index b70e8eafbb..44e8399e26 100644
--- a/backend/test/emailAuthorization.test.ts
+++ b/backend/test/emailAuthorization.test.ts
@@ -24,16 +24,16 @@ let userId: $TSFixMe, projectId: $TSFixMe;
const selectEmailStatus =
'from to subject body createdAt template status content error deleted deletedAt deletedById replyTo smtpServer';
-describe('Email verification API', function() {
+describe('Email verification API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- GlobalConfig.enableEmailLog().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ GlobalConfig.enableEmailLog().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
projectId = res.body.project._id;
@@ -44,7 +44,7 @@ describe('Email verification API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -61,7 +61,7 @@ describe('Email verification API', function() {
await EmailStatusService.hardDeleteBy({});
});
- it('should send email verification', async function() {
+ it('should send email verification', async function () {
await sleep(10000);
const emailStatuses = await EmailStatusService.findBy({
@@ -72,7 +72,7 @@ describe('Email verification API', function() {
expect(emailStatuses[0].status).to.equal('Success');
});
- it('should not login non-verified user', async function() {
+ it('should not login non-verified user', async function () {
try {
await request.post('/user/login').send({
email: userData.user.email,
@@ -83,7 +83,7 @@ describe('Email verification API', function() {
}
});
- it('should verify the user', async function() {
+ it('should verify the user', async function () {
const token = await VerificationTokenModel.findOne({ userId });
try {
await request.get(`/user/confirmation/${token.token}`).redirects(0);
@@ -97,7 +97,7 @@ describe('Email verification API', function() {
}
});
- it('should login the verified user', async function() {
+ it('should login the verified user', async function () {
const res = await request.post('/user/login').send({
email: userData.user.email,
password: userData.user.password,
diff --git a/backend/test/emailLogs.test.ts b/backend/test/emailLogs.test.ts
index bf9d9e9096..91803ce1d0 100644
--- a/backend/test/emailLogs.test.ts
+++ b/backend/test/emailLogs.test.ts
@@ -20,36 +20,36 @@ import VerificationTokenModel from '../backend/models/verificationToken';
let token: $TSFixMe, projectId: $TSFixMe, userId: $TSFixMe;
let testSuiteStartTime: $TSFixMe, testCaseStartTime: $TSFixMe;
-describe('Email Logs API', function() {
+describe('Email Logs API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
testSuiteStartTime = new Date();
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -59,7 +59,7 @@ describe('Email Logs API', function() {
});
});
- after(async function() {
+ after(async function () {
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
email: {
@@ -89,11 +89,11 @@ describe('Email Logs API', function() {
await EmailLogsService.hardDeleteBy({ query: deleteQuery });
});
- beforeEach(async function() {
+ beforeEach(async function () {
testCaseStartTime = new Date();
});
- afterEach(async function() {
+ afterEach(async function () {
// Deleting any emailLogs created between each test case in this suite.
// Note that using timeStamp between this test suite to remove some logs, Beacuse some email logs dont contain specific 'userId'. (Ex. /login)
const deleteQuery = {
@@ -120,17 +120,17 @@ describe('Email Logs API', function() {
});
});
- it('should reject get email logs request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject get email logs request of an unauthenticated user', function (done: $TSFixMe) {
request
.get('/email-logs')
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject get email logs request of NON master-admin user', async function() {
+ it('should reject get email logs request of NON master-admin user', async function () {
const authorization = `Basic ${token}`;
await UserService.updateBy({ _id: userId }, { role: 'user' }); // Assigning user role
@@ -142,7 +142,7 @@ describe('Email Logs API', function() {
expect(res).to.have.status(400);
});
- it('should send get email logs data for master-admin user', async function() {
+ it('should send get email logs data for master-admin user', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -159,7 +159,7 @@ describe('Email Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should send appopriate data set when limit is provided', async function() {
+ it('should send appopriate data set when limit is provided', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -182,7 +182,7 @@ describe('Email Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should send appopriate data set when skip is provided', async function() {
+ it('should send appopriate data set when skip is provided', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -208,17 +208,17 @@ describe('Email Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should reject search request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject search request of an unauthenticated user', function (done: $TSFixMe) {
request
.post('/email-logs/search')
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject search request of NON master-admin user', async function() {
+ it('should reject search request of NON master-admin user', async function () {
await UserService.updateBy({ _id: userId }, { role: 'user' }); // Resetting user to normal USER.
const authorization = `Basic ${token}`;
@@ -232,7 +232,7 @@ describe('Email Logs API', function() {
}
});
- it('should send Searched EmailLogs data for master-admin user', async function() {
+ it('should send Searched EmailLogs data for master-admin user', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
@@ -249,7 +249,7 @@ describe('Email Logs API', function() {
await UserService.updateBy({ _id: userId }, { role: 'null' }); // Resetting user to normal USER.
});
- it('should send only matched result to provided search string when searched.', async function() {
+ it('should send only matched result to provided search string when searched.', async function () {
await UserService.updateBy({ _id: userId }, { role: 'master-admin' }); // Making user a "MASTER-ADMIN"
const authorization = `Basic ${token}`;
diff --git a/backend/test/enterpriseAlert.test.ts b/backend/test/enterpriseAlert.test.ts
index 32f3cb746f..8aeb222a9c 100644
--- a/backend/test/enterpriseAlert.test.ts
+++ b/backend/test/enterpriseAlert.test.ts
@@ -24,15 +24,15 @@ let token: $TSFixMe,
incidentId: $TSFixMe,
alertId: $TSFixMe;
-describe('Enterprise Alert API', function() {
+describe('Enterprise Alert API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createEnterpriseUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createEnterpriseUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -45,7 +45,7 @@ describe('Enterprise Alert API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
@@ -59,9 +59,9 @@ describe('Enterprise Alert API', function() {
},
componentId: component._id,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
incidentData.monitors = [monitorId];
@@ -74,7 +74,7 @@ describe('Enterprise Alert API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await MonitorService.hardDeleteBy({ _id: monitorId });
@@ -85,13 +85,13 @@ describe('Enterprise Alert API', function() {
await AlertService.hardDeleteBy({ _id: alertId });
});
- it('should create alert with valid details for project with no billing plan', function(done: $TSFixMe) {
+ it('should create alert with valid details for project with no billing plan', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/incident/${projectId}/create-incident`)
.set('Authorization', authorization)
.send(incidentData)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
incidentId = res.body._id;
request
.post(`/alert/${projectId}`)
@@ -102,7 +102,7 @@ describe('Enterprise Alert API', function() {
incidentId,
eventType: 'identified',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
alertId = res.body._id;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
diff --git a/backend/test/enterpriseComponent.test.ts b/backend/test/enterpriseComponent.test.ts
index 2a00b57349..9c8b1e9ee2 100644
--- a/backend/test/enterpriseComponent.test.ts
+++ b/backend/test/enterpriseComponent.test.ts
@@ -19,15 +19,15 @@ let token: $TSFixMe,
newProjectId: $TSFixMe,
componentId: $TSFixMe;
-describe('Enterprise Component API', function() {
+describe('Enterprise Component API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createEnterpriseUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createEnterpriseUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -38,7 +38,7 @@ describe('Enterprise Component API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -46,7 +46,7 @@ describe('Enterprise Component API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, newProjectId] },
@@ -57,7 +57,7 @@ describe('Enterprise Component API', function() {
});
});
- it('should create a new component for project with no billing plan', function(done: $TSFixMe) {
+ it('should create a new component for project with no billing plan', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post('/project/create')
@@ -65,7 +65,7 @@ describe('Enterprise Component API', function() {
.send({
projectName: 'Test Project',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
newProjectId = res.body._id;
request
.post(`/component/${newProjectId}`)
@@ -73,7 +73,7 @@ describe('Enterprise Component API', function() {
.send({
name: 'New Component',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
componentId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Component');
diff --git a/backend/test/enterpriseDisableSignup.test.ts b/backend/test/enterpriseDisableSignup.test.ts
index d003e497ec..a3f1065765 100644
--- a/backend/test/enterpriseDisableSignup.test.ts
+++ b/backend/test/enterpriseDisableSignup.test.ts
@@ -13,10 +13,10 @@ import { createUser } from './utils/userSignUp';
import UserService from '../backend/services/userService';
import ProjectService from '../backend/services/projectService';
-describe('Disable Sign up test', function() {
+describe('Disable Sign up test', function () {
this.timeout(200000);
let token: $TSFixMe = null;
- this.beforeAll(async function() {
+ this.beforeAll(async function () {
this.timeout(400000);
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({});
@@ -38,7 +38,7 @@ describe('Disable Sign up test', function() {
});
it('should not sign up the user when sign up is disabled', (done: $TSFixMe) => {
- createUser(request, data.user, function(err: $TSFixMe, res: $TSFixMe) {
+ createUser(request, data.user, function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Sign up is disabled.');
done();
@@ -53,7 +53,7 @@ describe('Disable Sign up test', function() {
.send({
...data.anotherUser,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('email');
expect(res.body).to.have.property('role');
diff --git a/backend/test/enterpriseIncidentAlerts.test.ts b/backend/test/enterpriseIncidentAlerts.test.ts
index 6bb4b88ac0..73fd8afb41 100644
--- a/backend/test/enterpriseIncidentAlerts.test.ts
+++ b/backend/test/enterpriseIncidentAlerts.test.ts
@@ -48,15 +48,15 @@ let authorization: $TSFixMe,
monitorId: $TSFixMe,
scheduleId;
-describe('Incident Alerts', function() {
+describe('Incident Alerts', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
GlobalConfig.initTestConfig().then(() => {
- createEnterpriseUser(request, userData.user, async function(
+ createEnterpriseUser(request, userData.user, async function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -72,7 +72,7 @@ describe('Incident Alerts', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
authorization = `Basic ${token}`;
@@ -159,7 +159,7 @@ describe('Incident Alerts', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await OnCallScheduleStatusService.hardDeleteBy({ project: projectId });
await SubscriberService.hardDeleteBy({ projectId });
@@ -191,7 +191,7 @@ describe('Incident Alerts', function() {
* Global twilio settings (SMS/Call) enable : true
*/
- it('should send SMS/Call alerts to on-call teams and subscribers if the SMS/Call alerts are enabled globally.', async function() {
+ it('should send SMS/Call alerts to on-call teams and subscribers if the SMS/Call alerts are enabled globally.', async function () {
const globalSettings = await GlobalConfigModel.findOne({
name: 'twilio',
});
@@ -276,7 +276,7 @@ describe('Incident Alerts', function() {
* Global twilio settings Call enable : false
*/
- it('should not send Call alerts to on-call teams if the Call alerts are disabled in the global twilio configurations.', async function() {
+ it('should not send Call alerts to on-call teams if the Call alerts are disabled in the global twilio configurations.', async function () {
const globalSettings = await GlobalConfigModel.findOne({
name: 'twilio',
});
@@ -369,7 +369,7 @@ describe('Incident Alerts', function() {
* Global twilio settings Call enable : true
*/
- it('should not send SMS alerts to on-call teams and subscriber if the SMS alerts are disabled in the global twilio configurations.', async function() {
+ it('should not send SMS alerts to on-call teams and subscriber if the SMS alerts are disabled in the global twilio configurations.', async function () {
const globalSettings = await GlobalConfigModel.findOne({
name: 'twilio',
});
@@ -467,7 +467,7 @@ describe('Incident Alerts', function() {
* Global twilio settings Call enable : false
*/
- it('should send SMS/Call alerts to on-call teams and subscriber even if the alerts are disabled in the global twilio settings.', async function() {
+ it('should send SMS/Call alerts to on-call teams and subscriber even if the alerts are disabled in the global twilio settings.', async function () {
const globalSettings = await GlobalConfigModel.findOne({
name: 'twilio',
});
@@ -573,7 +573,7 @@ describe('Incident Alerts', function() {
* Custom twilio settings: not set
*/
- it('should not SMS/Call alerts to on-call teams and subscriber if global and custom twilio settings are removed.', async function() {
+ it('should not SMS/Call alerts to on-call teams and subscriber if global and custom twilio settings are removed.', async function () {
await GlobalConfigModel.deleteMany({
name: 'twilio',
});
diff --git a/backend/test/enterpriseMonitor.test.ts b/backend/test/enterpriseMonitor.test.ts
index 07182333ef..1155ef1c99 100644
--- a/backend/test/enterpriseMonitor.test.ts
+++ b/backend/test/enterpriseMonitor.test.ts
@@ -21,15 +21,15 @@ let token: $TSFixMe,
newProjectId: $TSFixMe,
monitorId: $TSFixMe;
-describe('Enterprise Monitor API', function() {
+describe('Enterprise Monitor API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createEnterpriseUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createEnterpriseUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -40,7 +40,7 @@ describe('Enterprise Monitor API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -48,7 +48,7 @@ describe('Enterprise Monitor API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, newProjectId] },
@@ -59,7 +59,7 @@ describe('Enterprise Monitor API', function() {
});
});
- it('should create a new monitor for project with no billing plan', function(done: $TSFixMe) {
+ it('should create a new monitor for project with no billing plan', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
ComponentModel.create({ name: 'Test Component' }).then(component => {
@@ -69,7 +69,7 @@ describe('Enterprise Monitor API', function() {
.send({
projectName: 'Test Project',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
newProjectId = res.body._id;
request
.post(`/monitor/${newProjectId}`)
@@ -80,7 +80,7 @@ describe('Enterprise Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId: component._id,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor');
diff --git a/backend/test/enterpriseProject.test.ts b/backend/test/enterpriseProject.test.ts
index c40783d616..7e24a69bc7 100644
--- a/backend/test/enterpriseProject.test.ts
+++ b/backend/test/enterpriseProject.test.ts
@@ -15,15 +15,15 @@ import ProjectService from '../backend/services/projectService';
let token: $TSFixMe, projectId: $TSFixMe, newProjectId: $TSFixMe;
-describe('Enterprise Project API', function() {
+describe('Enterprise Project API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createEnterpriseUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createEnterpriseUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -34,7 +34,7 @@ describe('Enterprise Project API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -42,7 +42,7 @@ describe('Enterprise Project API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, newProjectId] },
@@ -52,7 +52,7 @@ describe('Enterprise Project API', function() {
});
});
- it('should create a project when `planId` is not given', function(done: $TSFixMe) {
+ it('should create a project when `planId` is not given', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post('/project/create')
@@ -60,7 +60,7 @@ describe('Enterprise Project API', function() {
.send({
projectName: 'Test Project',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
newProjectId = res.body._id;
expect(res).to.have.status(200);
done();
@@ -72,7 +72,7 @@ describe('Enterprise Project API', function() {
request
.delete(`/project/${projectId}/deleteProject`)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
done();
});
@@ -83,7 +83,7 @@ describe('Enterprise Project API', function() {
request
.put(`/project/${projectId}/restoreProject`)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
done();
});
diff --git a/backend/test/enterpriseTeam.test.ts b/backend/test/enterpriseTeam.test.ts
index 0c1722c0b6..4638897e13 100644
--- a/backend/test/enterpriseTeam.test.ts
+++ b/backend/test/enterpriseTeam.test.ts
@@ -17,15 +17,15 @@ let token: $TSFixMe, projectId: $TSFixMe, newProjectId: $TSFixMe;
const teamEmail = 'noreply1@oneuptime.com';
-describe('Enterprise Team API', function() {
+describe('Enterprise Team API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createEnterpriseUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createEnterpriseUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -36,7 +36,7 @@ describe('Enterprise Team API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -44,7 +44,7 @@ describe('Enterprise Team API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, newProjectId] },
@@ -56,7 +56,7 @@ describe('Enterprise Team API', function() {
});
});
- it('should add new user with valid details for project with no billing plan', function(done: $TSFixMe) {
+ it('should add new user with valid details for project with no billing plan', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/team/${projectId}`)
@@ -65,7 +65,7 @@ describe('Enterprise Team API', function() {
emails: teamEmail,
role: 'Member',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body[0].team[0].userId).to.be.a('string');
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
diff --git a/backend/test/enterpriseUser.test.ts b/backend/test/enterpriseUser.test.ts
index 611c6af5e0..31a95e1e61 100644
--- a/backend/test/enterpriseUser.test.ts
+++ b/backend/test/enterpriseUser.test.ts
@@ -18,15 +18,15 @@ let projectId: $TSFixMe,
userRole: $TSFixMe,
token: $TSFixMe;
-describe('Enterprise User API', function() {
+describe('Enterprise User API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createEnterpriseUser(request, data.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createEnterpriseUser(request, data.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
@@ -38,7 +38,7 @@ describe('Enterprise User API', function() {
email: data.user.email,
password: data.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -61,14 +61,14 @@ describe('Enterprise User API', function() {
});
});
- it('should sign up initial user as `master-admin`', function() {
+ it('should sign up initial user as `master-admin`', function () {
expect(userRole).to.equal('master-admin');
});
- it('should confirm that `master-admin` exists', function(done: $TSFixMe) {
+ it('should confirm that `master-admin` exists', function (done: $TSFixMe) {
request
.get('/user/masterAdminExists')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).have.property('result');
expect(res.body.result).to.eql(true);
@@ -78,10 +78,10 @@ describe('Enterprise User API', function() {
// 'post /user/signup'
- it('should register `user` without stripeToken, stripePlanId', function(done: $TSFixMe) {
- createEnterpriseUser(request, data.newUser, function(
+ it('should register `user` without stripeToken, stripePlanId', function (done: $TSFixMe) {
+ createEnterpriseUser(request, data.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
newProjectId = project._id;
@@ -94,14 +94,14 @@ describe('Enterprise User API', function() {
});
});
- it('should login with valid credentials', function(done: $TSFixMe) {
+ it('should login with valid credentials', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: data.newUser.email,
password: data.newUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.email).to.equal(
data.newUser.email.toLocaleLowerCase()
@@ -111,7 +111,7 @@ describe('Enterprise User API', function() {
});
});
- it('should login with valid credentials, and return sent redirect url', function(done: $TSFixMe) {
+ it('should login with valid credentials, and return sent redirect url', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
@@ -119,7 +119,7 @@ describe('Enterprise User API', function() {
password: data.newUser.password,
redirect: 'http://oneuptime.com',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.email).to.equal(
data.newUser.email.toLocaleLowerCase()
@@ -130,12 +130,12 @@ describe('Enterprise User API', function() {
});
});
- it('should get list of users without their hashed passwords', function(done: $TSFixMe) {
+ it('should get list of users without their hashed passwords', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/user/users')
.set('Authorization', authorization)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -150,14 +150,14 @@ describe('Enterprise User API', function() {
});
});
- it('should turn off 2fa for a user', function(done: $TSFixMe) {
+ it('should turn off 2fa for a user', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: data.newUser.email,
password: data.newUser.password,
})
- .then(function(res: $TSFixMe) {
+ .then(function (req: Response) {
const jwtToken = res.body.tokens.jwtAccessToken;
request
.put('/user/profile')
@@ -166,7 +166,7 @@ describe('Enterprise User API', function() {
twoFactorAuthEnabled: true,
email: data.newUser.email,
})
- .then(function(res: $TSFixMe) {
+ .then(function (req: Response) {
request
.put(`/user/${res.body._id}/2fa`)
.set('Authorization', `Basic ${token}`)
@@ -175,7 +175,7 @@ describe('Enterprise User API', function() {
twoFactorAuthEnabled: !res.body
.twoFactorAuthEnabled,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.twoFactorAuthEnabled).to.eql(
false
);
@@ -185,14 +185,14 @@ describe('Enterprise User API', function() {
});
});
- it('should not turn off 2fa for a user if loged in user is not admin', function(done: $TSFixMe) {
+ it('should not turn off 2fa for a user if loged in user is not admin', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: data.newUser.email,
password: data.newUser.password,
})
- .then(function(res: $TSFixMe) {
+ .then(function (req: Response) {
const jwtToken = res.body.tokens.jwtAccessToken;
request
.put('/user/profile')
@@ -201,7 +201,7 @@ describe('Enterprise User API', function() {
twoFactorAuthEnabled: true,
email: data.newUser.email,
})
- .then(function(res: $TSFixMe) {
+ .then(function (req: Response) {
request
.put(`/user/${res.body._id}/2fa`)
.set('Authorization', `Basic ${jwtToken}`)
@@ -210,7 +210,7 @@ describe('Enterprise User API', function() {
twoFactorAuthEnabled: !res.body
.twoFactorAuthEnabled,
})
- .end(function(err: $TSFixMe, result: $TSFixMe) {
+ .end(function (err: $TSFixMe, result: $TSFixMe) {
expect(result).to.have.status(400);
done();
});
diff --git a/backend/test/errorTracker.test.ts b/backend/test/errorTracker.test.ts
index 8db45b6ac1..85677b137a 100644
--- a/backend/test/errorTracker.test.ts
+++ b/backend/test/errorTracker.test.ts
@@ -25,35 +25,35 @@ let token: $TSFixMe,
errorEventMembers = 0;
const sampleErrorEvent = {};
-describe('Error Tracker API', function() {
+describe('Error Tracker API', function () {
this.timeout(80000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(95000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
@@ -62,9 +62,9 @@ describe('Error Tracker API', function() {
.send({
name: 'New Component',
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
componentId = res.body._id;
expect(res).to.have.status(200);
@@ -80,19 +80,19 @@ describe('Error Tracker API', function() {
});
});
- it('should reject the request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject the request of an unauthenticated user', function (done: $TSFixMe) {
request
.post(`/error-tracker/${projectId}/${componentId}/create`)
.send({
name: 'New Error Tracker',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject the request of an empty error tracker name', function(done: $TSFixMe) {
+ it('should reject the request of an empty error tracker name', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/error-tracker/${projectId}/${componentId}/create`)
@@ -100,13 +100,13 @@ describe('Error Tracker API', function() {
.send({
name: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create an error tracker', function(done: $TSFixMe) {
+ it('should create an error tracker', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/error-tracker/${projectId}/${componentId}/create`)
@@ -114,7 +114,7 @@ describe('Error Tracker API', function() {
.send({
name: 'Node Project',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
errorTracker = res.body;
expect(res).to.have.status(200);
expect(res.body).to.include({ name: 'Node Project' });
@@ -122,24 +122,24 @@ describe('Error Tracker API', function() {
});
});
- it('should return a list of error trackers under component', function(done: $TSFixMe) {
+ it('should return a list of error trackers under component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/error-tracker/${projectId}/${componentId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
});
});
- it('should not return a list of error trackers under wrong component', function(done: $TSFixMe) {
+ it('should not return a list of error trackers under wrong component', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/error-tracker/${projectId}/5ee8d7cc8701d678901ab908`) // wrong component ID
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Component does not exist.'
@@ -149,7 +149,7 @@ describe('Error Tracker API', function() {
});
// reset api key
- it('should reset error tracker key', function(done: $TSFixMe) {
+ it('should reset error tracker key', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const currentKey = errorTracker.key;
request
@@ -157,7 +157,7 @@ describe('Error Tracker API', function() {
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}/reset-key`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(errorTracker._id); // same error tracker id
expect(res.body.key).to.not.be.equal(currentKey); // error tracker key has chaged
@@ -167,7 +167,7 @@ describe('Error Tracker API', function() {
});
// edit error tracker details
- it('should update the current error tracker name', function(done: $TSFixMe) {
+ it('should update the current error tracker name', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const appName = 'Python API App';
request
@@ -176,7 +176,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ name: appName })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
const updatedErrorTracker = res.body;
expect(errorTracker._id).to.be.equal(updatedErrorTracker._id); // same id
@@ -187,20 +187,20 @@ describe('Error Tracker API', function() {
});
});
- it('should request for eventId for tracking an error event', function(done: $TSFixMe) {
+ it('should request for eventId for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Event ID is required.');
done();
});
});
- it('should request for fingerprint for tracking an error event', function(done: $TSFixMe) {
+ it('should request for fingerprint for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -208,7 +208,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Fingerprint is required.'
@@ -217,7 +217,7 @@ describe('Error Tracker API', function() {
});
});
- it('should request for fingerprint as an array for tracking an error event', function(done: $TSFixMe) {
+ it('should request for fingerprint as an array for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -227,7 +227,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Fingerprint is to be of type Array.'
@@ -236,7 +236,7 @@ describe('Error Tracker API', function() {
});
});
- it('should request for error event type for tracking an error event', function(done: $TSFixMe) {
+ it('should request for error event type for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -246,7 +246,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Error Event Type must be of the allowed types.'
@@ -255,7 +255,7 @@ describe('Error Tracker API', function() {
});
});
- it('should request for tags for tracking an error event', function(done: $TSFixMe) {
+ it('should request for tags for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -267,14 +267,14 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Tags is required.');
done();
});
});
- it('should request for timeline in array format for tracking an error event', function(done: $TSFixMe) {
+ it('should request for timeline in array format for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -290,7 +290,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Timeline is to be of type Array.'
@@ -299,7 +299,7 @@ describe('Error Tracker API', function() {
});
});
- it('should request for exception for tracking an error event', function(done: $TSFixMe) {
+ it('should request for exception for tracking an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -313,14 +313,14 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Exception is required.');
done();
});
});
- it('should declare Error Tracker not existing for an error event', function(done: $TSFixMe) {
+ it('should declare Error Tracker not existing for an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -338,7 +338,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Error Tracker does not exist.'
@@ -347,7 +347,7 @@ describe('Error Tracker API', function() {
});
});
- it('should create an error event and set a fingerprint hash and issueId', function(done: $TSFixMe) {
+ it('should create an error event and set a fingerprint hash and issueId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -367,7 +367,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
errorEvent = res.body; // save as an error event
@@ -380,7 +380,7 @@ describe('Error Tracker API', function() {
});
});
- it('should create a new error event with the old fingerprint, create a new one with a different fingerprint and confirm the two have different issueId', function(done: $TSFixMe) {
+ it('should create a new error event with the old fingerprint, create a new one with a different fingerprint and confirm the two have different issueId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
sampleErrorEvent.eventId = 'samplId';
@@ -400,7 +400,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200); // weve created an error event with the existing issue fingerprint
expect(res.body.issueId).to.be.equal(errorEvent.issueId);
@@ -409,7 +409,7 @@ describe('Error Tracker API', function() {
.post(`/error-tracker/${errorTracker._id}/track`)
.set('Authorization', authorization)
.send(sampleErrorEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
issueCount = issueCount + 1; // weve created a new issue entirely
@@ -426,14 +426,14 @@ describe('Error Tracker API', function() {
});
});
- it('should return a list of issues under an error event', function(done: $TSFixMe) {
+ it('should return a list of issues under an error event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}/issues`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data.errorTrackerIssues).to.be.an('array');
expect(res.body.data.count).to.be.equal(issueCount); // confirm the issue count is accurate
@@ -441,7 +441,7 @@ describe('Error Tracker API', function() {
});
});
- it('should return a list of issues under an error event based on limit', function(done: $TSFixMe) {
+ it('should return a list of issues under an error event based on limit', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const limit = 1;
request
@@ -450,7 +450,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ limit })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data.errorTrackerIssues).to.be.an('array');
expect(res.body.data.count).to.be.equal(limit); // confirm the issue count is accurate based on the limit
@@ -458,14 +458,14 @@ describe('Error Tracker API', function() {
});
});
- it('should return an error event with its next and previous', function(done: $TSFixMe) {
+ it('should return an error event with its next and previous', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}/error-events/${errorEvent._id}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.errorEvent).to.be.an('object');
expect(res.body.previous).to.be.equal(null); // since this error event is the first, nothing should come before it
@@ -475,21 +475,21 @@ describe('Error Tracker API', function() {
});
});
- it('should return an error when trying to ignore an issue without passing the IssueID', function(done: $TSFixMe) {
+ it('should return an error when trying to ignore an issue without passing the IssueID', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}/issues/action`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Issue ID is required');
done();
});
});
- it('should return an error when trying to ignore an issue without passing an array of issues', function(done: $TSFixMe) {
+ it('should return an error when trying to ignore an issue without passing an array of issues', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -497,7 +497,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ issueId: errorEvent.issueId })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Issue ID has to be of type array'
@@ -506,7 +506,7 @@ describe('Error Tracker API', function() {
});
});
- it('should return an error when trying to ignore an issue without passing a valid action type', function(done: $TSFixMe) {
+ it('should return an error when trying to ignore an issue without passing a valid action type', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -514,14 +514,14 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ issueId: [errorEvent.issueId], action: 'test' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Action is not allowed');
done();
});
});
- it('should ignore an issue successfully', function(done: $TSFixMe) {
+ it('should ignore an issue successfully', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -529,7 +529,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ issueId: [errorEvent.issueId], action: 'ignore' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('issues');
const currentIssue = res.body.issues.filter(
@@ -542,7 +542,7 @@ describe('Error Tracker API', function() {
});
});
- it('should resolve an issue and change the ignore state successfully', function(done: $TSFixMe) {
+ it('should resolve an issue and change the ignore state successfully', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -550,7 +550,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ issueId: [errorEvent.issueId], action: 'resolve' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('issues');
const currentIssue = res.body.issues.filter(
@@ -566,7 +566,7 @@ describe('Error Tracker API', function() {
});
});
- it('should unresolve an issue and change the ignore and resolved state successfully', function(done: $TSFixMe) {
+ it('should unresolve an issue and change the ignore and resolved state successfully', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -574,7 +574,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ issueId: [errorEvent.issueId], action: 'unresolve' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('issues');
const currentIssue = res.body.issues.filter(
@@ -589,14 +589,14 @@ describe('Error Tracker API', function() {
});
});
- it('should not fetch errors attached to a fingerprint if fingerprint is not provided', function(done: $TSFixMe) {
+ it('should not fetch errors attached to a fingerprint if fingerprint is not provided', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}/error-events`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Fingerprint Hash is required'
@@ -605,7 +605,7 @@ describe('Error Tracker API', function() {
});
});
- it('should fetch errors attached to a fingerprint successfully', function(done: $TSFixMe) {
+ it('should fetch errors attached to a fingerprint successfully', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -613,7 +613,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ fingerprintHash: errorEvent.fingerprintHash })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body[res.body.length - 1]._id).to.be.equal(
@@ -623,7 +623,7 @@ describe('Error Tracker API', function() {
});
});
- it('should fetch errors attached to a fingerprint successfully based on limit', function(done: $TSFixMe) {
+ it('should fetch errors attached to a fingerprint successfully based on limit', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const limit = 1;
request
@@ -632,7 +632,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ fingerprintHash: errorEvent.fingerprintHash, limit })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body.length).to.be.equal(limit);
@@ -640,7 +640,7 @@ describe('Error Tracker API', function() {
});
});
- it('should fetch members attached to an issue successfully', function(done: $TSFixMe) {
+ it('should fetch members attached to an issue successfully', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -648,7 +648,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ fingerprintHash: errorEvent.fingerprintHash })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.have.property('issueId');
expect(res.body).to.be.have.property('issueMembers');
@@ -660,14 +660,14 @@ describe('Error Tracker API', function() {
});
});
- it('should not assign member to issue due to no member ID passed', function(done: $TSFixMe) {
+ it('should not assign member to issue due to no member ID passed', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}/assign/${errorEvent.issueId}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Team Member ID is required'
@@ -676,7 +676,7 @@ describe('Error Tracker API', function() {
});
});
- it('should not assign member to issue if member ID is not of required type', function(done: $TSFixMe) {
+ it('should not assign member to issue if member ID is not of required type', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -684,7 +684,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ teamMemberId: userId })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Team Member ID has to be of type array'
@@ -693,7 +693,7 @@ describe('Error Tracker API', function() {
});
});
- it('should assign member to issue if member ID is of required type', function(done: $TSFixMe) {
+ it('should assign member to issue if member ID is of required type', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -701,7 +701,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ teamMemberId: [userId] })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
errorEventMembers += 1; // increase the member count
expect(res.body.issueId).to.be.equal(errorEvent.issueId);
@@ -714,7 +714,7 @@ describe('Error Tracker API', function() {
});
});
- it('should unassign member to issue if member ID is of required type', function(done: $TSFixMe) {
+ it('should unassign member to issue if member ID is of required type', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(
@@ -722,7 +722,7 @@ describe('Error Tracker API', function() {
)
.set('Authorization', authorization)
.send({ teamMemberId: [userId] })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
errorEventMembers -= 1;
expect(res.body.issueId).to.be.equal(errorEvent.issueId);
@@ -732,14 +732,14 @@ describe('Error Tracker API', function() {
});
// delete error tracker
- it('should delete the error tracker', function(done: $TSFixMe) {
+ it('should delete the error tracker', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(
`/error-tracker/${projectId}/${componentId}/${errorTracker._id}`
)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.deleted).to.be.equal(true);
done();
diff --git a/backend/test/feedback.test.ts b/backend/test/feedback.test.ts
index 2b12719ca3..0e259556fd 100644
--- a/backend/test/feedback.test.ts
+++ b/backend/test/feedback.test.ts
@@ -21,22 +21,22 @@ const selectEmailStatus =
let token: $TSFixMe, projectId: $TSFixMe, userId: $TSFixMe;
-describe('Feedback API', function() {
+describe('Feedback API', function () {
this.timeout(50000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- GlobalConfig.enableEmailLog().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ GlobalConfig.enableEmailLog().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -45,16 +45,16 @@ describe('Feedback API', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
done();
@@ -66,7 +66,7 @@ describe('Feedback API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -82,7 +82,7 @@ describe('Feedback API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should create feedback and check the sent emails to oneuptime team and user', async function() {
+ it('should create feedback and check the sent emails to oneuptime team and user', async function () {
const authorization = `Basic ${token}`;
const testFeedback = {
feedback: 'test feedback',
diff --git a/backend/test/gitCredential.test.ts b/backend/test/gitCredential.test.ts
index cd13fc628f..911b397136 100644
--- a/backend/test/gitCredential.test.ts
+++ b/backend/test/gitCredential.test.ts
@@ -18,37 +18,37 @@ import ProjectService from '../backend/services/projectService';
import GitCredentialService from '../backend/services/gitCredentialService';
import AirtableService from '../backend/services/airtableService';
-describe('Git Credential API', function() {
+describe('Git Credential API', function () {
const timeout = 30000;
let projectId: $TSFixMe, userId, token: $TSFixMe, credentialId: $TSFixMe;
this.timeout(timeout);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -58,7 +58,7 @@ describe('Git Credential API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -70,7 +70,7 @@ describe('Git Credential API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should add git credential', function(done: $TSFixMe) {
+ it('should add git credential', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const gitUsername = 'username';
const gitPassword = 'password';
@@ -82,7 +82,7 @@ describe('Git Credential API', function() {
gitUsername,
gitPassword,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
credentialId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.gitUsername).to.be.equal(gitUsername);
@@ -90,7 +90,7 @@ describe('Git Credential API', function() {
});
});
- it('should update a git credential', function(done: $TSFixMe) {
+ it('should update a git credential', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const newGitUsername = 'newusername';
@@ -100,14 +100,14 @@ describe('Git Credential API', function() {
.send({
gitUsername: newGitUsername,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.gitUsername).to.be.equal(newGitUsername);
done();
});
});
- it('should get all the git credentials in a project', function(done: $TSFixMe) {
+ it('should get all the git credentials in a project', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const gitUsername = 'anotherUsername';
const gitPassword = 'password';
@@ -119,11 +119,11 @@ describe('Git Credential API', function() {
gitUsername,
gitPassword,
})
- .end(function() {
+ .end(function () {
request
.get(`/credential/${projectId}/gitCredential`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
@@ -131,13 +131,13 @@ describe('Git Credential API', function() {
});
});
- it('should remove a git credential', function(done: $TSFixMe) {
+ it('should remove a git credential', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/credential/${projectId}/gitCredential/${credentialId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(credentialId);
expect(res.body.deleted).to.be.true;
@@ -145,7 +145,7 @@ describe('Git Credential API', function() {
});
});
- it('should not create git credential with an existing git user in a project', function(done: $TSFixMe) {
+ it('should not create git credential with an existing git user in a project', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const gitUsername = 'anotherUsername'; // an existing username
const gitPassword = 'password';
@@ -157,7 +157,7 @@ describe('Git Credential API', function() {
gitUsername,
gitPassword,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Git Credential already exist in this project'
@@ -166,7 +166,7 @@ describe('Git Credential API', function() {
});
});
- it('should not create git credential if git username is missing', function(done: $TSFixMe) {
+ it('should not create git credential if git username is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const gitUsername = '';
const gitPassword = 'password';
@@ -178,7 +178,7 @@ describe('Git Credential API', function() {
gitUsername,
gitPassword,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Git Username is required'
@@ -187,7 +187,7 @@ describe('Git Credential API', function() {
});
});
- it('should not create git credential if git password is missing', function(done: $TSFixMe) {
+ it('should not create git credential if git password is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const gitUsername = 'username';
@@ -197,7 +197,7 @@ describe('Git Credential API', function() {
.send({
gitUsername,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Please provide a password'
@@ -206,14 +206,14 @@ describe('Git Credential API', function() {
});
});
- it('should not remove a non-existing git credential', function(done: $TSFixMe) {
+ it('should not remove a non-existing git credential', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const credentialId = '5e8db97b2cc46e3a229ebc62'; // non-existing credential id
request
.delete(`/credential/${projectId}/gitCredential/${credentialId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Git Credential not found or does not exist'
diff --git a/backend/test/globalConfig.test.ts b/backend/test/globalConfig.test.ts
index 8ba5ff4736..0e885c6b89 100644
--- a/backend/test/globalConfig.test.ts
+++ b/backend/test/globalConfig.test.ts
@@ -17,40 +17,40 @@ import VerificationTokenModel from '../backend/models/verificationToken';
import GlobalConfig from './utils/globalConfig';
let projectId: $TSFixMe, userId: $TSFixMe, token: $TSFixMe;
-describe('Global Config API', function() {
+describe('Global Config API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(100000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, data.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, data.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: data.user.email,
password: data.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
UserService.updateBy(
{ _id: userId },
{ role: 'master-admin' }
- ).then(function() {
+ ).then(function () {
done();
});
});
@@ -74,7 +74,7 @@ describe('Global Config API', function() {
});
});
- it('should create global config when name and value are valid', function(done: $TSFixMe) {
+ it('should create global config when name and value are valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const globalConfig = {
name: 'TestName',
@@ -84,7 +84,7 @@ describe('Global Config API', function() {
.post('/globalConfig')
.set('Authorization', authorization)
.send(globalConfig)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.equal(globalConfig.name);
expect(res.body.value).to.equal(globalConfig.value);
@@ -92,7 +92,7 @@ describe('Global Config API', function() {
});
});
- it('should create multiple global configs when details are valid', function(done: $TSFixMe) {
+ it('should create multiple global configs when details are valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const globalConfigs = [
{
@@ -108,7 +108,7 @@ describe('Global Config API', function() {
.post('/globalConfig')
.set('Authorization', authorization)
.send(globalConfigs)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -125,27 +125,27 @@ describe('Global Config API', function() {
});
});
- it('should not create global config when name and value are not valid', function(done: $TSFixMe) {
+ it('should not create global config when name and value are not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const globalConfig = { name: null };
request
.post('/globalConfig')
.set('Authorization', authorization)
.send(globalConfig)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should get multiple global configs when names are provided', function(done: $TSFixMe) {
+ it('should get multiple global configs when names are provided', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const globalConfigs = ['TestName', 'Other TestName'];
request
.post('/globalConfig/configs')
.set('Authorization', authorization)
.send(globalConfigs)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -160,24 +160,24 @@ describe('Global Config API', function() {
});
});
- it('should get global config by name', function(done: $TSFixMe) {
+ it('should get global config by name', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/globalConfig/TestName')
.set('Authorization', authorization)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.equal('TestName');
done();
});
});
- it('should retrieve global config for audit Log status', function(done: $TSFixMe) {
+ it('should retrieve global config for audit Log status', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/globalConfig/auditLogMonitoringStatus')
.set('Authorization', authorization)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.equal('auditLogMonitoringStatus');
expect(res.body.value).to.equal(true);
@@ -185,13 +185,13 @@ describe('Global Config API', function() {
});
});
- it('should toggle global config for audit Log status', function(done: $TSFixMe) {
+ it('should toggle global config for audit Log status', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post('/globalConfig')
.set('Authorization', authorization)
.send({ name: 'auditLogMonitoringStatus', value: false })
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.equal('auditLogMonitoringStatus');
expect(res.body.value).to.equal(false);
diff --git a/backend/test/incidentPriority.test.ts b/backend/test/incidentPriority.test.ts
index 59f259faa0..f7a9c2e766 100644
--- a/backend/test/incidentPriority.test.ts
+++ b/backend/test/incidentPriority.test.ts
@@ -22,34 +22,34 @@ let token: $TSFixMe,
defaultIncidentPriorityId: $TSFixMe,
newIncidentPriorityId: $TSFixMe;
-describe('Incident Priority API', function() {
+describe('Incident Priority API', function () {
this.timeout(500000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(90000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
projectId = res.body.project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -59,7 +59,7 @@ describe('Incident Priority API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await IncidentSettings.hardDeleteBy({ projectId: projectId });
await UserService.hardDeleteBy({ _id: userId });
@@ -91,7 +91,7 @@ describe('Incident Priority API', function() {
.delete(`/incidentPriorities/${projectId}`)
.set('Authorization', authorization)
.send({ _id: defaultIncidentPriorityId })
- .end((error: $TSFixMe, res: $TSFixMe) => {
+ .end((error: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
diff --git a/backend/test/incidentSettings.test.ts b/backend/test/incidentSettings.test.ts
index 6b71116b7f..f198ea7663 100644
--- a/backend/test/incidentSettings.test.ts
+++ b/backend/test/incidentSettings.test.ts
@@ -46,34 +46,34 @@ const incidentSettings = {
name: 'Another update',
};
-describe('Incident Settings API', function() {
+describe('Incident Settings API', function () {
this.timeout(500000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(90000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
projectId = res.body.project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
ComponentModel.create({
@@ -85,9 +85,9 @@ describe('Incident Settings API', function() {
.post(`/monitor/${projectId}`)
.set('Authorization', authorization)
.send({ ...monitor, componentId })
- .end(async function(
+ .end(async function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
expect(res).to.have.status(200);
@@ -104,7 +104,7 @@ describe('Incident Settings API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await IncidentService.hardDeleteBy({ _id: incidentId });
await IncidentSettings.hardDeleteBy({ projectId });
diff --git a/backend/test/incomingHttpRequest.test.ts b/backend/test/incomingHttpRequest.test.ts
index 35d272f58a..77e5a8d9ce 100644
--- a/backend/test/incomingHttpRequest.test.ts
+++ b/backend/test/incomingHttpRequest.test.ts
@@ -32,7 +32,7 @@ const {
acknowledgeRequest,
} = require('./data/incomingHttpRequest');
-describe('Incoming HTTP Request API', function() {
+describe('Incoming HTTP Request API', function () {
const timeout = 30000;
let projectId: $TSFixMe,
componentId,
@@ -50,31 +50,31 @@ describe('Incoming HTTP Request API', function() {
this.timeout(timeout);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
authorization = `Basic ${token}`;
@@ -82,9 +82,9 @@ describe('Incoming HTTP Request API', function() {
.post(`/component/${projectId}`)
.set('Authorization', authorization)
.send({ name: 'Test Component' })
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
componentId = res.body._id;
@@ -110,9 +110,9 @@ describe('Incoming HTTP Request API', function() {
},
],
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
@@ -123,7 +123,7 @@ describe('Incoming HTTP Request API', function() {
'monitorField',
fieldType: 'text',
}
- ).then(function() {
+ ).then(function () {
done();
});
});
@@ -135,7 +135,7 @@ describe('Incoming HTTP Request API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -150,11 +150,11 @@ describe('Incoming HTTP Request API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should create an incoming http request (Create Incident)', function(done: $TSFixMe) {
+ it('should create an incoming http request (Create Incident)', function (done: $TSFixMe) {
IncidentPrioritiesService.findOne({
query: { projectId },
select: '_id',
- }).then(function(priority) {
+ }).then(function (priority) {
// fetch one of the priorities
incidentPriorityId = priority._id;
incidentRequest.incidentPriority = incidentPriorityId;
@@ -163,7 +163,7 @@ describe('Incoming HTTP Request API', function() {
.post(`/incoming-request/${projectId}/create-request-url`)
.set('Authorization', authorization)
.send(incidentRequest)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
requestId = res.body._id;
createIncidentUrl = res.body.url;
expect(res).to.have.status(200);
@@ -174,12 +174,12 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should create an incoming http request (Acknowledge Incident)', function(done: $TSFixMe) {
+ it('should create an incoming http request (Acknowledge Incident)', function (done: $TSFixMe) {
request
.post(`/incoming-request/${projectId}/create-request-url`)
.set('Authorization', authorization)
.send(acknowledgeRequest)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
acknowledgeIncidentUrl = res.body.url;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(acknowledgeRequest.name);
@@ -188,12 +188,12 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should create an incoming http request (Resolve Incident)', function(done: $TSFixMe) {
+ it('should create an incoming http request (Resolve Incident)', function (done: $TSFixMe) {
request
.post(`/incoming-request/${projectId}/create-request-url`)
.set('Authorization', authorization)
.send(resolveRequest)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
resolveIncidentUrl = res.body.url;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(resolveRequest.name);
@@ -202,12 +202,12 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should create an incoming http request (Update incident note)', function(done: $TSFixMe) {
+ it('should create an incoming http request (Update incident note)', function (done: $TSFixMe) {
request
.post(`/incoming-request/${projectId}/create-request-url`)
.send(incidentNoteRequest)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
incidentNoteUrl = res.body.url;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(incidentNoteRequest.name);
@@ -219,12 +219,12 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should create an incoming http request (Update internal note)', function(done: $TSFixMe) {
+ it('should create an incoming http request (Update internal note)', function (done: $TSFixMe) {
request
.post(`/incoming-request/${projectId}/create-request-url`)
.send(internalNoteRequest)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
internalNoteUrl = res.body.url;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(internalNoteRequest.name);
@@ -236,7 +236,7 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should update an incoming http request', function(done: $TSFixMe) {
+ it('should update an incoming http request', function (done: $TSFixMe) {
const update = {
name: 'updateName',
};
@@ -245,14 +245,14 @@ describe('Incoming HTTP Request API', function() {
.put(`/incoming-request/${projectId}/update/${requestId}`)
.send(update)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(update.name);
done();
});
});
- it('should list all the created incoming http request in a project', function(done: $TSFixMe) {
+ it('should list all the created incoming http request in a project', function (done: $TSFixMe) {
incidentRequest.name = 'anotherOne';
incidentRequest.selectAllMonitors = false;
incidentRequest.monitors = [monitorId];
@@ -261,13 +261,13 @@ describe('Incoming HTTP Request API', function() {
.post(`/incoming-request/${projectId}/create-request-url`)
.set('Authorization', authorization)
.send(incidentRequest)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
requestId = res.body._id;
request
.get(`/incoming-request/${projectId}/all-incoming-request`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('array');
done();
@@ -275,11 +275,11 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should create an incident with incoming http request url', function(done: $TSFixMe) {
+ it('should create an incident with incoming http request url', function (done: $TSFixMe) {
axios({
method: 'post',
url: createIncidentUrl,
- }).then(function(res) {
+ }).then(function (res) {
expect(res).to.have.status(200);
expect(res.data.status).to.be.equal('success');
expect(res.data.created_incidents).to.be.an('array');
@@ -287,11 +287,11 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should acknowledge an incident with an incoming http request url', function(done: $TSFixMe) {
+ it('should acknowledge an incident with an incoming http request url', function (done: $TSFixMe) {
axios({
method: 'post',
url: acknowledgeIncidentUrl,
- }).then(function(res) {
+ }).then(function (res) {
expect(res).to.have.status(200);
expect(res.data.status).to.be.equal('success');
expect(res.data.acknowledged_incidents).to.be.an('array');
@@ -299,11 +299,11 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should resolve an incident with an incoming http request url', function(done: $TSFixMe) {
+ it('should resolve an incident with an incoming http request url', function (done: $TSFixMe) {
axios({
method: 'post',
url: resolveIncidentUrl,
- }).then(function(res) {
+ }).then(function (res) {
expect(res).to.have.status(200);
expect(res.data.status).to.be.equal('success');
expect(res.data.resolved_incidents).to.be.an('array');
@@ -311,12 +311,12 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should add incident note with an incoming http request url', function(done: $TSFixMe) {
+ it('should add incident note with an incoming http request url', function (done: $TSFixMe) {
// it should also work for a get request
axios({
method: 'get',
url: incidentNoteUrl,
- }).then(function(res) {
+ }).then(function (res) {
expect(res).to.have.status(200);
expect(res.data.status).to.be.equal('success');
expect(res.data.notes_addedTo).to.be.an('array');
@@ -324,11 +324,11 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should add internal note with an incoming http request url', function(done: $TSFixMe) {
+ it('should add internal note with an incoming http request url', function (done: $TSFixMe) {
axios({
method: 'get',
url: internalNoteUrl,
- }).then(function(res) {
+ }).then(function (res) {
expect(res).to.have.status(200);
expect(res.data.status).to.be.equal('success');
expect(res.data.notes_addedTo).to.be.an('array');
@@ -336,11 +336,11 @@ describe('Incoming HTTP Request API', function() {
});
});
- it('should delete an incoming http request in project', function(done: $TSFixMe) {
+ it('should delete an incoming http request in project', function (done: $TSFixMe) {
request
.delete(`/incoming-request/${projectId}/remove/${requestId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(String(res.body._id)).to.be.equal(String(requestId));
done();
diff --git a/backend/test/jwttoken.test.ts b/backend/test/jwttoken.test.ts
index 2206a10d61..e35b40b0b2 100644
--- a/backend/test/jwttoken.test.ts
+++ b/backend/test/jwttoken.test.ts
@@ -18,35 +18,35 @@ import { createUser } from './utils/userSignUp';
let token: $TSFixMe, projectId: $TSFixMe, refreshToken: $TSFixMe, userId;
-describe('Jwt Token API', function() {
+describe('Jwt Token API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
refreshToken =
res.body.tokens.jwtRefreshToken;
@@ -58,7 +58,7 @@ describe('Jwt Token API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -73,13 +73,13 @@ describe('Jwt Token API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should get new access and refresh token when provided a valid jwtRefreshToken', function(done: $TSFixMe) {
+ it('should get new access and refresh token when provided a valid jwtRefreshToken', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post('/token/new')
.set('Authorization', authorization)
.send({ refreshToken: refreshToken })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
diff --git a/backend/test/lead.test.ts b/backend/test/lead.test.ts
index 2f17155d9b..a6a2b4386b 100644
--- a/backend/test/lead.test.ts
+++ b/backend/test/lead.test.ts
@@ -24,35 +24,35 @@ const leadData = {
const selectEmailStatus =
'from to subject body createdAt template status content error deleted deletedAt deletedById replyTo smtpServer';
-describe('Lead API', function() {
+describe('Lead API', function () {
this.timeout(20000);
- before(async function() {
+ before(async function () {
this.timeout(30000);
await GlobalConfig.initTestConfig();
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
});
- it('should add lead when requested for type demo or whitepaper', function(done: $TSFixMe) {
+ it('should add lead when requested for type demo or whitepaper', function (done: $TSFixMe) {
request
.post('/lead')
.send(leadData)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
leadService.hardDeleteBy({ _id: res.body._id });
done();
});
});
- it('should add lead when requested for type demo and check the sent message', function(done: $TSFixMe) {
+ it('should add lead when requested for type demo and check the sent message', function (done: $TSFixMe) {
this.timeout(60000);
request
.post('/lead')
.send(leadData)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
leadService.hardDeleteBy({ _id: res.body._id });
const emailStatuses = await EmailStatusService.findBy({
diff --git a/backend/test/monitor.test.ts b/backend/test/monitor.test.ts
index e2d2a20634..2903ade7c4 100755
--- a/backend/test/monitor.test.ts
+++ b/backend/test/monitor.test.ts
@@ -78,26 +78,26 @@ const httpMonitorCriteria = {
},
};
-describe('Monitor API', function() {
+describe('Monitor API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- ComponentModel.create({ name: 'Test Component' }, function(
+ ComponentModel.create({ name: 'Test Component' }, function (
err,
component
) {
componentId = component;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -106,16 +106,16 @@ describe('Monitor API', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
done();
@@ -127,7 +127,7 @@ describe('Monitor API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await MonitorService.hardDeleteBy({ projectId });
await ProjectService.hardDeleteBy({ _id: projectId });
@@ -144,19 +144,19 @@ describe('Monitor API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should reject the request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject the request of an unauthenticated user', function (done: $TSFixMe) {
request
.post(`/monitor/${projectId}`)
.send({
name: 'New Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should not create a monitor when the `name` field is null', function(done: $TSFixMe) {
+ it('should not create a monitor when the `name` field is null', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -167,13 +167,13 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create a monitor when the `type` field is null', function(done: $TSFixMe) {
+ it('should not create a monitor when the `type` field is null', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -184,13 +184,13 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create a monitor when the `data` field is not valid', function(done: $TSFixMe) {
+ it('should not create a monitor when the `data` field is not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -201,13 +201,13 @@ describe('Monitor API', function() {
data: null,
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create an agentless server monitor when identityFile authentication is selected and the `identityFile` field is not valid', function(done: $TSFixMe) {
+ it('should not create an agentless server monitor when identityFile authentication is selected and the `identityFile` field is not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -220,13 +220,13 @@ describe('Monitor API', function() {
},
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create a new monitor when the correct data is given by an authenticated user', function(done: $TSFixMe) {
+ it('should create a new monitor when the correct data is given by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -237,7 +237,7 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 3');
@@ -245,7 +245,7 @@ describe('Monitor API', function() {
});
});
- it('should add a new site url to a monitor', function(done: $TSFixMe) {
+ it('should add a new site url to a monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}/siteUrl/${monitorId}`)
@@ -253,7 +253,7 @@ describe('Monitor API', function() {
.send({
siteUrl: 'https://twitter.com',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(monitorId);
expect(res.body.siteUrls).to.contain('https://twitter.com');
@@ -261,7 +261,7 @@ describe('Monitor API', function() {
});
});
- it('should remove a site url from a monitor', function(done: $TSFixMe) {
+ it('should remove a site url from a monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/monitor/${projectId}/siteUrl/${monitorId}`)
@@ -269,7 +269,7 @@ describe('Monitor API', function() {
.send({
siteUrl: 'https://twitter.com',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(monitorId);
expect(res.body.siteUrls).to.not.contain('https://twitter.com');
@@ -277,7 +277,7 @@ describe('Monitor API', function() {
});
});
- it('should not create a new monitor with invalid call schedule', function(done: $TSFixMe) {
+ it('should not create a new monitor with invalid call schedule', function (done: $TSFixMe) {
const scheduleId = 20;
const authorization = `Basic ${token}`;
request
@@ -290,13 +290,13 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create a new monitor with valid call schedule', function(done: $TSFixMe) {
+ it('should create a new monitor with valid call schedule', function (done: $TSFixMe) {
let scheduleId;
const authorization = `Basic ${token}`;
request
@@ -305,7 +305,7 @@ describe('Monitor API', function() {
.send({
name: 'Valid Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
scheduleId = res.body._id;
request
.post(`/monitor/${projectId}`)
@@ -317,14 +317,14 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 5');
request
.get(`/schedule/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -337,7 +337,7 @@ describe('Monitor API', function() {
});
});
- it('should create two new monitors and add them to one call schedule', function(done: $TSFixMe) {
+ it('should create two new monitors and add them to one call schedule', function (done: $TSFixMe) {
let scheduleId: $TSFixMe;
const authorization = `Basic ${token}`;
request
@@ -346,7 +346,7 @@ describe('Monitor API', function() {
.send({
name: 'Valid Schedule for two monitors',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
scheduleId = res.body._id;
request
.post(`/monitor/${projectId}`)
@@ -358,7 +358,7 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
request
.post(`/monitor/${projectId}`)
@@ -370,14 +370,14 @@ describe('Monitor API', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
request
.get(`/schedule/${projectId}`)
.set('Authorization', authorization)
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -399,7 +399,7 @@ describe('Monitor API', function() {
});
});
- it('should update a monitor when the correct data is given by an authenticated user', function(done: $TSFixMe) {
+ it('should update a monitor when the correct data is given by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/monitor/${projectId}/${monitorId}`)
@@ -411,19 +411,19 @@ describe('Monitor API', function() {
url: 'https://twitter.com',
},
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(monitorId);
done();
});
});
- it('should get monitors for an authenticated user by ProjectId', function(done: $TSFixMe) {
+ it('should get monitors for an authenticated user by ProjectId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/monitor/${projectId}/monitor`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -432,12 +432,12 @@ describe('Monitor API', function() {
});
});
- it('should get a monitor for an authenticated user with valid monitorId', function(done: $TSFixMe) {
+ it('should get a monitor for an authenticated user with valid monitorId', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/monitor/${projectId}/monitor/${monitorId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body._id).to.be.equal(monitorId);
@@ -445,12 +445,12 @@ describe('Monitor API', function() {
});
});
- it('should delete a monitor when monitorId is valid', function(done: $TSFixMe) {
+ it('should delete a monitor when monitorId is valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/monitor/${projectId}/${monitorId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
@@ -462,26 +462,26 @@ const HTTP_TEST_SERVER_URL = 'http://localhost:3010';
const testServer = chai.request(HTTP_TEST_SERVER_URL);
-describe('API Monitor API', function() {
+describe('API Monitor API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- ComponentModel.create({ name: 'Test Component' }, function(
+ ComponentModel.create({ name: 'Test Component' }, function (
err,
component
) {
componentId = component;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -490,16 +490,16 @@ describe('API Monitor API', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
testServer
@@ -523,7 +523,7 @@ describe('API Monitor API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await MonitorService.hardDeleteBy({ _id: monitorId });
await UserService.hardDeleteBy({
@@ -533,7 +533,7 @@ describe('API Monitor API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should not add API monitor with invalid website url', function(done: $TSFixMe) {
+ it('should not add API monitor with invalid website url', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -545,7 +545,7 @@ describe('API Monitor API', function() {
data: { url: 'https://google.com' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'API Monitor URL should not be a HTML page.'
@@ -554,7 +554,7 @@ describe('API Monitor API', function() {
});
});
- it('should not add API monitor with invalid url', function(done: $TSFixMe) {
+ it('should not add API monitor with invalid url', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -566,13 +566,13 @@ describe('API Monitor API', function() {
data: { url: `https://oneuptime.com/api/monitor/${projectId}` },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not add API monitor with empty or invalid header', function(done: $TSFixMe) {
+ it('should not add API monitor with empty or invalid header', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -584,14 +584,14 @@ describe('API Monitor API', function() {
data: { url: `${BACKEND_URL}/monitor/${projectId}` },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Unauthorized');
done();
});
});
- it('should not add API monitor with empty body', function(done: $TSFixMe) {
+ it('should not add API monitor with empty body', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -604,14 +604,14 @@ describe('API Monitor API', function() {
data: { url: `${BACKEND_URL}/monitor/${projectId}` },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Bad Request');
done();
});
});
- it('should not add API monitor with invalid body', function(done: $TSFixMe) {
+ it('should not add API monitor with invalid body', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -626,14 +626,14 @@ describe('API Monitor API', function() {
data: { url: `${BACKEND_URL}/monitor/${projectId}` },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Bad Request');
done();
});
});
- it('should add API monitor with valid url', function(done: $TSFixMe) {
+ it('should add API monitor with valid url', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -645,7 +645,7 @@ describe('API Monitor API', function() {
data: { url: HTTP_TEST_SERVER_URL },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 30');
@@ -653,7 +653,7 @@ describe('API Monitor API', function() {
});
});
- it('should not edit API monitor with invalid url', function(done: $TSFixMe) {
+ it('should not edit API monitor with invalid url', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/monitor/${projectId}/${monitorId}`)
@@ -665,7 +665,7 @@ describe('API Monitor API', function() {
data: { url: 'https://google.com' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'API Monitor URL should not be a HTML page.'
@@ -675,26 +675,26 @@ describe('API Monitor API', function() {
});
});
-describe('IncomingHttpRequest Monitor', function() {
+describe('IncomingHttpRequest Monitor', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- ComponentModel.create({ name: 'Test Component' }, function(
+ ComponentModel.create({ name: 'Test Component' }, function (
err,
component
) {
componentId = component;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -703,16 +703,16 @@ describe('IncomingHttpRequest Monitor', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
done();
@@ -724,7 +724,7 @@ describe('IncomingHttpRequest Monitor', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await MonitorService.hardDeleteBy({ _id: monitorId });
await MonitorService.hardDeleteBy({ _id: monitor2Id });
@@ -735,7 +735,7 @@ describe('IncomingHttpRequest Monitor', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should create a new IncomingHttpRequest monitor', function(done: $TSFixMe) {
+ it('should create a new IncomingHttpRequest monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -750,7 +750,7 @@ describe('IncomingHttpRequest Monitor', function() {
},
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 120');
@@ -758,50 +758,50 @@ describe('IncomingHttpRequest Monitor', function() {
});
});
- it('should report monitor degraded when api has no body in post request', function(done: $TSFixMe) {
+ it('should report monitor degraded when api has no body in post request', function (done: $TSFixMe) {
request
.post(`/incomingHttpRequest/${httpMonitorId}`)
.send({})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.monitorId).to.be.equal(monitorId);
expect(res.body.status).to.be.equal('degraded');
done();
});
});
- it('should report monitor degraded when api has no body in get request', function(done: $TSFixMe) {
+ it('should report monitor degraded when api has no body in get request', function (done: $TSFixMe) {
request
.get(`/incomingHttpRequest/${httpMonitorId}`)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.monitorId).to.be.equal(monitorId);
expect(res.body.status).to.be.equal('degraded');
done();
});
});
- it('should report monitor up when api has a valid body in post request', function(done: $TSFixMe) {
+ it('should report monitor up when api has a valid body in post request', function (done: $TSFixMe) {
request
.post(`/incomingHttpRequest/${httpMonitorId}`)
.send({ id: '123456' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.monitorId).to.be.equal(monitorId);
expect(res.body.status).to.be.equal('online');
done();
});
});
- it('should report monitor up when api has a valid body in get request', function(done: $TSFixMe) {
+ it('should report monitor up when api has a valid body in get request', function (done: $TSFixMe) {
request
.get(`/incomingHttpRequest/${httpMonitorId}`)
.send({ id: '123456' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.monitorId).to.be.equal(monitorId);
expect(res.body.status).to.be.equal('online');
done();
});
});
- it('should create a new IncomingHttpRequest monitor with query params and request headers', function(done: $TSFixMe) {
+ it('should create a new IncomingHttpRequest monitor with query params and request headers', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const criteria = { ...httpMonitorCriteria };
criteria.up.and.push({
@@ -830,7 +830,7 @@ describe('IncomingHttpRequest Monitor', function() {
},
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitor2Id = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 121');
@@ -838,23 +838,23 @@ describe('IncomingHttpRequest Monitor', function() {
});
});
- it('should report monitor offline when api has no query param and request headers in post request', function(done: $TSFixMe) {
+ it('should report monitor offline when api has no query param and request headers in post request', function (done: $TSFixMe) {
request
.post(`/incomingHttpRequest/${httpMonitor2Id}`)
.send({ id: '123456' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.monitorId).to.be.equal(monitor2Id);
expect(res.body.status).to.be.equal('offline');
done();
});
});
- it('should report monitor up when api has the query param and request headers', function(done: $TSFixMe) {
+ it('should report monitor up when api has the query param and request headers', function (done: $TSFixMe) {
request
.post(`/incomingHttpRequest/${httpMonitor2Id}?abc=xyz`)
.set('Cache-Control', 'no-cache')
.send({ id: '123456' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body.monitorId).to.be.equal(monitor2Id);
expect(res.body.status).to.be.equal('online');
done();
@@ -862,43 +862,43 @@ describe('IncomingHttpRequest Monitor', function() {
});
});
-describe('Monitor API with resource Category', function() {
+describe('Monitor API with resource Category', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
.post(`/resourceCategory/${projectId}`)
.set('Authorization', authorization)
.send(resourceCategory)
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
resourceCategoryId = res.body._id;
done();
@@ -910,14 +910,14 @@ describe('Monitor API with resource Category', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ResourceCategoryService.hardDeleteBy({ _id: resourceCategoryId });
await MonitorService.hardDeleteBy({ _id: monitorId });
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should create a new monitor when the resource Category is provided by an authenticated user', function(done: $TSFixMe) {
+ it('should create a new monitor when the resource Category is provided by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -929,7 +929,7 @@ describe('Monitor API with resource Category', function() {
resourceCategory: resourceCategoryId,
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 8');
@@ -946,26 +946,26 @@ let subProjectId: $TSFixMe,
newUserToken: $TSFixMe,
subProjectMonitorId: $TSFixMe;
-describe('Monitor API with Sub-Projects', function() {
+describe('Monitor API with Sub-Projects', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
const authorization = `Basic ${token}`;
// create a subproject for parent project
request
.post(`/project/${projectId}/subProject`)
.set('Authorization', authorization)
.send({ subProjectName: 'New SubProject' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectId = res.body[0]._id;
// sign up second user (subproject user)
- createUser(request, userData.newUser, function(
+ createUser(request, userData.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -974,16 +974,16 @@ describe('Monitor API with Sub-Projects', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.newUser.email,
password: userData.newUser.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
newUserToken =
res.body.tokens.jwtAccessToken;
@@ -1000,7 +1000,7 @@ describe('Monitor API with Sub-Projects', function() {
userData.newUser.email,
role: 'Member',
})
- .end(function() {
+ .end(function () {
done();
});
});
@@ -1011,33 +1011,33 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await MonitorService.hardDeleteBy({ _id: monitorId });
await MonitorService.hardDeleteBy({ _id: subProjectMonitorId });
});
- it('should not create a monitor for user not present in project', function(done: $TSFixMe) {
- createUser(request, userData.anotherUser, function(
+ it('should not create a monitor for user not present in project', function (done: $TSFixMe) {
+ createUser(request, userData.anotherUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.anotherUser.email,
password: userData.anotherUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
request
.post(`/monitor/${projectId}`)
@@ -1048,9 +1048,9 @@ describe('Monitor API with Sub-Projects', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -1064,7 +1064,7 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it('should not create a monitor for user that is not `admin` in project.', function(done: $TSFixMe) {
+ it('should not create a monitor for user that is not `admin` in project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.post(`/monitor/${subProjectId}`)
@@ -1075,7 +1075,7 @@ describe('Monitor API with Sub-Projects', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You cannot edit the project because you're not an admin."
@@ -1084,7 +1084,7 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it('should create a monitor in parent project by valid admin.', function(done: $TSFixMe) {
+ it('should create a monitor in parent project by valid admin.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
@@ -1095,7 +1095,7 @@ describe('Monitor API with Sub-Projects', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 11');
@@ -1103,7 +1103,7 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it('should create a monitor in sub-project.', function(done: $TSFixMe) {
+ it('should create a monitor in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/monitor/${subProjectId}`)
@@ -1114,7 +1114,7 @@ describe('Monitor API with Sub-Projects', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectMonitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 12');
@@ -1122,12 +1122,12 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it("should get only sub-project's monitors for valid sub-project user", function(done: $TSFixMe) {
+ it("should get only sub-project's monitors for valid sub-project user", function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.get(`/monitor/${subProjectId}/monitor`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -1138,12 +1138,12 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it('should get both project and sub-project monitors for valid parent project user.', function(done: $TSFixMe) {
+ it('should get both project and sub-project monitors for valid parent project user.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/monitor/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body[0]).to.have.property('monitors');
@@ -1154,12 +1154,12 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it('should not delete a monitor for user that is not `admin` in sub-project.', function(done: $TSFixMe) {
+ it('should not delete a monitor for user that is not `admin` in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.delete(`/monitor/${subProjectId}/${subProjectMonitorId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You cannot edit the project because you're not an admin."
@@ -1168,30 +1168,30 @@ describe('Monitor API with Sub-Projects', function() {
});
});
- it('should delete sub-project monitor', function(done: $TSFixMe) {
+ it('should delete sub-project monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/monitor/${subProjectId}/${subProjectMonitorId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should delete project monitor', function(done: $TSFixMe) {
+ it('should delete project monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/monitor/${projectId}/${monitorId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
});
-describe('Monitor API - Tests Project Seats With SubProjects', function() {
+describe('Monitor API - Tests Project Seats With SubProjects', function () {
this.timeout(30000);
const monitorDataArray = [
@@ -1247,7 +1247,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
},
];
- before(async function() {
+ before(async function () {
this.timeout(30000);
await GlobalConfig.initTestConfig();
const authorization = `Basic ${token}`;
@@ -1264,7 +1264,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
);
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, subProjectId] },
@@ -1281,7 +1281,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
await MonitorService.hardDeleteBy({ projectId });
});
- it('should not create a new monitor because the monitor count limit is reached (Startup Plan -> 5 monitors/user).', function(done: $TSFixMe) {
+ it('should not create a new monitor because the monitor count limit is reached (Startup Plan -> 5 monitors/user).', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -1293,7 +1293,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You can't add any more monitors. Please upgrade your account."
@@ -1302,7 +1302,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: $TSFixMe) {
+ it('should be able to create more monitor on upgrade of project to Growth plan.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const growthPlan = 'plan_GoWKgxRnPPBJWy';
@@ -1322,7 +1322,7 @@ describe('Monitor API - Tests Project Seats With SubProjects', function() {
data: { url: 'http://www.tests.org' },
componentId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('New Monitor 15');
diff --git a/backend/test/monitorCriteria.test.ts b/backend/test/monitorCriteria.test.ts
index e0d9b08dfd..55bab7e2ec 100644
--- a/backend/test/monitorCriteria.test.ts
+++ b/backend/test/monitorCriteria.test.ts
@@ -17,35 +17,35 @@ import AirtableService from '../backend/services/airtableService';
let token: $TSFixMe, projectId: $TSFixMe, userId: $TSFixMe;
-describe('Monitor Criteria API', function() {
+describe('Monitor Criteria API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -55,7 +55,7 @@ describe('Monitor Criteria API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -71,12 +71,12 @@ describe('Monitor Criteria API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should get the monitor criteria', function(done: $TSFixMe) {
+ it('should get the monitor criteria', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/monitorCriteria')
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
diff --git a/backend/test/monitorCustomField.test.ts b/backend/test/monitorCustomField.test.ts
index 227c4e9df5..bb385b7d13 100644
--- a/backend/test/monitorCustomField.test.ts
+++ b/backend/test/monitorCustomField.test.ts
@@ -19,7 +19,7 @@ import ProjectService from '../backend/services/projectService';
import ComponentService from '../backend/services/componentService';
import MonitorCustomFieldService from '../backend/services/monitorCustomField';
-describe('Monitor Custom Field API', function() {
+describe('Monitor Custom Field API', function () {
const timeout = 30000;
let projectId: $TSFixMe,
userId,
@@ -28,9 +28,9 @@ describe('Monitor Custom Field API', function() {
monitorCustomFieldId: $TSFixMe;
const monitorFieldText = {
- fieldName: 'textField',
- fieldType: 'text',
- },
+ fieldName: 'textField',
+ fieldType: 'text',
+ },
monitorFieldNumber = {
fieldName: 'numField',
fieldType: 'number',
@@ -38,31 +38,31 @@ describe('Monitor Custom Field API', function() {
this.timeout(timeout);
- before(function(done: $TSFixMe) {
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ before(function (done: $TSFixMe) {
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
authorization = `Basic ${token}`;
done();
@@ -73,7 +73,7 @@ describe('Monitor Custom Field API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -84,36 +84,36 @@ describe('Monitor Custom Field API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should not create a monitor custom field when field name is missing or not specified', function(done: $TSFixMe) {
+ it('should not create a monitor custom field when field name is missing or not specified', function (done: $TSFixMe) {
request
.post(`/monitorCustomField/${projectId}`)
.send({ fieldType: 'text' })
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Field name is required');
done();
});
});
- it('should not create a monitor custom field when field type is missing or not specified', function(done: $TSFixMe) {
+ it('should not create a monitor custom field when field type is missing or not specified', function (done: $TSFixMe) {
request
.post(`/monitorCustomField/${projectId}`)
.send({ fieldName: 'missingType' })
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal('Field type is required');
done();
});
});
- it('should setup custom fields for all monitors in a project (text)', function(done: $TSFixMe) {
+ it('should setup custom fields for all monitors in a project (text)', function (done: $TSFixMe) {
request
.post(`/monitorCustomField/${projectId}`)
.send(monitorFieldText)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
monitorCustomFieldId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.fieldName).to.be.equal(
@@ -123,12 +123,12 @@ describe('Monitor Custom Field API', function() {
});
});
- it('should not create monitor custom field with an existing name in a project', function(done: $TSFixMe) {
+ it('should not create monitor custom field with an existing name in a project', function (done: $TSFixMe) {
request
.post(`/monitorCustomField/${projectId}`)
.send(monitorFieldText)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Custom field with this name already exist'
@@ -137,14 +137,14 @@ describe('Monitor Custom Field API', function() {
});
});
- it('should update a particular monitor custom field in a project', function(done: $TSFixMe) {
+ it('should update a particular monitor custom field in a project', function (done: $TSFixMe) {
monitorFieldText.fieldName = 'newName';
request
.put(`/monitorCustomField/${projectId}/${monitorCustomFieldId}`)
.send(monitorFieldText)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.fieldName).to.be.equal(
monitorFieldText.fieldName
@@ -156,17 +156,17 @@ describe('Monitor Custom Field API', function() {
});
});
- it('should list all the monitor custom fields in a project', function(done: $TSFixMe) {
+ it('should list all the monitor custom fields in a project', function (done: $TSFixMe) {
// add one more monitor custom field
request
.post(`/monitorCustomField/${projectId}`)
.send(monitorFieldNumber)
.set('Authorization', authorization)
- .end(function() {
+ .end(function () {
request
.get(`/monitorCustomField/${projectId}?skip=0&limit=10`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.count).to.be.equal(2);
expect(res.body.data).to.be.an('array');
@@ -175,11 +175,11 @@ describe('Monitor Custom Field API', function() {
});
});
- it('should delete a particular monitor custom field in a project', function(done: $TSFixMe) {
+ it('should delete a particular monitor custom field in a project', function (done: $TSFixMe) {
request
.delete(`/monitorCustomField/${projectId}/${monitorCustomFieldId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(String(res.body._id)).to.be.equal(
String(monitorCustomFieldId)
diff --git a/backend/test/notification.test.ts b/backend/test/notification.test.ts
index 9bc467966d..0dad057443 100644
--- a/backend/test/notification.test.ts
+++ b/backend/test/notification.test.ts
@@ -20,35 +20,35 @@ import { createUser } from './utils/userSignUp';
let projectId: $TSFixMe, token: $TSFixMe, userId;
-describe('Notification API', function() {
+describe('Notification API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -58,7 +58,7 @@ describe('Notification API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -83,20 +83,20 @@ describe('Notification API', function() {
message: 'New Notification',
icon: 'bell',
})
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
});
});
- it('should get project notifications current user is present in', function(done: $TSFixMe) {
+ it('should get project notifications current user is present in', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/notification/${projectId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -105,19 +105,19 @@ describe('Notification API', function() {
});
});
- it('should not get project notifications current user is not present in', function(done: $TSFixMe) {
+ it('should not get project notifications current user is not present in', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/notification/${projectData.firstProject._id}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should mark project notification as read', function(done: $TSFixMe) {
+ it('should mark project notification as read', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/notification/${projectId}`)
@@ -126,13 +126,13 @@ describe('Notification API', function() {
message: 'New Notification',
icon: 'bell',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const notificationId = res.body._id;
request
.put(`/notification/${projectId}/read`)
.set('Authorization', authorization)
.send({ notificationIds: [notificationId] })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body).to.include(notificationId);
@@ -141,7 +141,7 @@ describe('Notification API', function() {
});
});
- it('should close a notification', function(done: $TSFixMe) {
+ it('should close a notification', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/notification/${projectId}`)
@@ -150,12 +150,12 @@ describe('Notification API', function() {
message: 'New Notification',
icon: 'bell',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const notificationId = res.body._id;
request
.put(`/notification/${projectId}/${notificationId}/closed`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body._id).to.be.equal(notificationId);
@@ -164,7 +164,7 @@ describe('Notification API', function() {
});
});
- it('should mark all project notifications as read', function(done: $TSFixMe) {
+ it('should mark all project notifications as read', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/notification/${projectId}`)
@@ -173,22 +173,22 @@ describe('Notification API', function() {
message: 'New Notification',
icon: 'bell',
})
- .end(function() {
+ .end(function () {
request
.put(`/notification/${projectId}/readAll`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
});
- it('should reject request if the notification param is invalid ', function(done: $TSFixMe) {
+ it('should reject request if the notification param is invalid ', function (done: $TSFixMe) {
request
.put(`/notification/${projectId}/read`)
.send({ notificationIds: [projectData.fakeProject._id] })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
diff --git a/backend/test/probe.test.ts b/backend/test/probe.test.ts
index f8829e34be..809ffac999 100644
--- a/backend/test/probe.test.ts
+++ b/backend/test/probe.test.ts
@@ -47,10 +47,10 @@ const probeServerRequestHeader = ({
});
let probeServerName1: $TSFixMe, probeServerName2: $TSFixMe;
-describe('Probe API', function() {
+describe('Probe API', function () {
this.timeout(20000);
- before(async function() {
+ before(async function () {
this.timeout(40000);
await GlobalConfig.initTestConfig();
// remove every monitor in DB
@@ -84,7 +84,7 @@ describe('Probe API', function() {
return Promise.resolve();
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProbeService.hardDeleteBy({ _id: probeId });
await ProjectService.hardDeleteBy({ _id: projectId });
@@ -110,7 +110,7 @@ describe('Probe API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should add a probe by admin', function(done: $TSFixMe) {
+ it('should add a probe by admin', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const probeName = generateRandomString();
request
@@ -120,7 +120,7 @@ describe('Probe API', function() {
probeName: probeName,
probeKey: probeKey,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
probeId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.probeName).to.be.equal(probeName);
@@ -128,28 +128,28 @@ describe('Probe API', function() {
});
});
- it('should not add a probe if not admin', function(done: $TSFixMe) {
+ it('should not add a probe if not admin', function (done: $TSFixMe) {
const probeName = generateRandomString();
- createUser(request, userData.newUser, function(
+ createUser(request, userData.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.newUser.email,
password: userData.newUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
request
.post('/probe/')
@@ -158,9 +158,9 @@ describe('Probe API', function() {
probeName: probeName,
probeKey: '',
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
done();
@@ -171,7 +171,7 @@ describe('Probe API', function() {
});
});
- it('should reject a probe if same name already exists', function(done: $TSFixMe) {
+ it('should reject a probe if same name already exists', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const probeName = generateRandomString();
request
@@ -181,7 +181,7 @@ describe('Probe API', function() {
probeName: probeName,
probeKey: probeKey,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
request
.post('/probe/')
@@ -190,26 +190,26 @@ describe('Probe API', function() {
probeName: probeName,
probeKey: probeKey,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
});
- it('should get probes', function(done: $TSFixMe) {
+ it('should get probes', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/probe/')
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should delete a probe by admin', function(done: $TSFixMe) {
+ it('should delete a probe by admin', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const probeName = generateRandomString();
request
@@ -219,21 +219,21 @@ describe('Probe API', function() {
probeName: probeName,
probeKey: probeKey,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
probeId = res.body._id;
expect(res).to.have.status(200);
request
.delete(`/probe/${probeId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
});
- it('should add to the database the unknown probe servers requesting the list of monitor to ping.', async function() {
+ it('should add to the database the unknown probe servers requesting the list of monitor to ping.', async function () {
probeServerName1 = generateRandomString();
const res = await request.get('/probe/monitors').set(
probeServerRequestHeader({
@@ -252,7 +252,7 @@ describe('Probe API', function() {
expect(probe).to.not.eql(null);
});
- it('should return the list of monitors of type "server-monitor" only time for one probe server during an interval of 1 min ', async function() {
+ it('should return the list of monitors of type "server-monitor" only time for one probe server during an interval of 1 min ', async function () {
this.timeout(100000);
const monitor = await MonitorService.create({
projectId,
@@ -334,7 +334,7 @@ describe('Probe API', function() {
await MonitorService.hardDeleteBy({ _id: monitor._id });
});
- it('should return the list of monitors of type "url" only 1 time for every probe server during an interval of 1 min', async function() {
+ it('should return the list of monitors of type "url" only 1 time for every probe server during an interval of 1 min', async function () {
this.timeout(100000);
const monitor = await MonitorService.create({
projectId,
@@ -417,7 +417,7 @@ describe('Probe API', function() {
await MonitorService.hardDeleteBy({ _id: monitor._id });
});
- it('should get application securities yet to be scanned or scanned 24hrs ago', function(done: $TSFixMe) {
+ it('should get application securities yet to be scanned or scanned 24hrs ago', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const probeName = 'US';
const probeKey = '33b674ca-9fdd-11e9-a2a3-2a2ae2dbccez';
@@ -427,7 +427,7 @@ describe('Probe API', function() {
gitUsername: gitCredential.gitUsername,
gitPassword: gitCredential.gitPassword,
projectId,
- }).then(function(credential) {
+ }).then(function (credential) {
const data = {
name: 'Test',
gitRepositoryUrl: gitCredential.gitRepositoryUrl,
@@ -439,7 +439,7 @@ describe('Probe API', function() {
.post(`/security/${projectId}/${componentId}/application`)
.set('Authorization', authorization)
.send(data)
- .end(function() {
+ .end(function () {
request
.get('/probe/applicationSecurities')
.set({
@@ -447,7 +447,7 @@ describe('Probe API', function() {
probeKey,
clusterKey,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
@@ -456,7 +456,7 @@ describe('Probe API', function() {
});
});
- it('should get container securities yet to be scanned or scanned 24hrs ago', function(done: $TSFixMe) {
+ it('should get container securities yet to be scanned or scanned 24hrs ago', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const probeName = 'US';
const probeKey = '33b674ca-9fdd-11e9-a2a3-2a2ae2dbccez';
@@ -467,7 +467,7 @@ describe('Probe API', function() {
dockerUsername: dockerCredential.dockerUsername,
dockerPassword: dockerCredential.dockerPassword,
projectId,
- }).then(function(credential) {
+ }).then(function (credential) {
const data = {
name: 'Test',
dockerCredential: credential._id,
@@ -479,7 +479,7 @@ describe('Probe API', function() {
.post(`/security/${projectId}/${componentId}/container`)
.set('Authorization', authorization)
.send(data)
- .end(function() {
+ .end(function () {
request
.get('/probe/containerSecurities')
.set({
@@ -487,7 +487,7 @@ describe('Probe API', function() {
probeKey,
clusterKey,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
diff --git a/backend/test/reports.test.ts b/backend/test/reports.test.ts
index 1626656a75..7621289c3d 100644
--- a/backend/test/reports.test.ts
+++ b/backend/test/reports.test.ts
@@ -34,35 +34,35 @@ const startDate = moment()
.format('YYYY-MM-DD');
const filter = 'month';
-describe('Reports API', function() {
+describe('Reports API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
ComponentModel.create({
@@ -75,9 +75,9 @@ describe('Reports API', function() {
...monitor,
componentId: component._id,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
done();
@@ -90,7 +90,7 @@ describe('Reports API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -116,7 +116,7 @@ describe('Reports API', function() {
`/reports/${projectId}/active-members?startDate=${startDate}&&endDate=${endDate}&&skip=0&&limit=10`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -132,7 +132,7 @@ describe('Reports API', function() {
`/reports/${projectId}/active-monitors?startDate=${startDate}&&endDate=${endDate}&&skip=0&&limit=10`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -148,7 +148,7 @@ describe('Reports API', function() {
`/reports/${projectId}/average-resolved?startDate=${startDate}&&endDate=${endDate}&&filter=${filter}`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
@@ -162,7 +162,7 @@ describe('Reports API', function() {
`/reports/${projectId}/incidents?startDate=${startDate}&&endDate=${endDate}&&filter=${filter}`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
diff --git a/backend/test/schedule.test.ts b/backend/test/schedule.test.ts
index 4bf44a5ec3..53cc2ba325 100644
--- a/backend/test/schedule.test.ts
+++ b/backend/test/schedule.test.ts
@@ -20,34 +20,34 @@ import VerificationTokenModel from '../backend/models/verificationToken';
let token: $TSFixMe, projectId: $TSFixMe, scheduleId: $TSFixMe, userId;
-describe('Schedule API', function() {
+describe('Schedule API', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
projectId = res.body.project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -57,7 +57,7 @@ describe('Schedule API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ScheduleService.hardDeleteBy({ _id: scheduleId });
await AirtableService.deleteAll({ tableName: 'User' });
@@ -65,19 +65,19 @@ describe('Schedule API', function() {
// 'post /schedule/:projectId/create'
- it('should reject the request of an unauthenticated user', function(done: $TSFixMe) {
+ it('should reject the request of an unauthenticated user', function (done: $TSFixMe) {
request
.post(`/schedule/${projectId}`)
.send({
name: 'New Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should not create a schedule when the `name` field is null', function(done: $TSFixMe) {
+ it('should not create a schedule when the `name` field is null', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/schedule/${projectId}`)
@@ -85,13 +85,13 @@ describe('Schedule API', function() {
.send({
name: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create a new schedule when `name` is given by an authenticated user', function(done: $TSFixMe) {
+ it('should create a new schedule when `name` is given by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/schedule/${projectId}`)
@@ -99,7 +99,7 @@ describe('Schedule API', function() {
.send({
name: 'Valid Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
scheduleId = res.body._id;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -107,12 +107,12 @@ describe('Schedule API', function() {
});
});
- it('should get schedules for an authenticated user', function(done: $TSFixMe) {
+ it('should get schedules for an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/schedule/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -121,7 +121,7 @@ describe('Schedule API', function() {
});
});
- it('should rename a schedule when the `projectId` is valid and the `scheduleName` is given', function(done: $TSFixMe) {
+ it('should rename a schedule when the `projectId` is valid and the `scheduleName` is given', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/schedule/${projectId}/${scheduleId}`)
@@ -129,7 +129,7 @@ describe('Schedule API', function() {
.send({
name: 'Renamed Schedule',
})
- .end(function(err: $TSFixMe, response: $TSFixMe) {
+ .end(function (err: $TSFixMe, response: $TSFixMe) {
scheduleId = response.body[0]._id;
expect(response).to.have.status(200);
expect(response.body).to.be.an('array');
@@ -138,7 +138,7 @@ describe('Schedule API', function() {
});
});
- it('should delete a schedule when the `projectId` and `scheduleId` is valid', function(done: $TSFixMe) {
+ it('should delete a schedule when the `projectId` and `scheduleId` is valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/schedule/${projectId}`)
@@ -146,11 +146,11 @@ describe('Schedule API', function() {
.send({
name: 'Delete Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
request
.delete(`/schedule/${projectId}/${res.body._id}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, response: $TSFixMe) {
+ .end(function (err: $TSFixMe, response: $TSFixMe) {
expect(response).to.have.status(200);
ScheduleService.hardDeleteBy({ _id: res.body._id });
done();
@@ -164,28 +164,28 @@ let subProjectId: $TSFixMe,
newUserToken: $TSFixMe,
subProjectScheduleId: $TSFixMe;
-describe('Schedule API with Sub-Projects', function() {
+describe('Schedule API with Sub-Projects', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
const authorization = `Basic ${token}`;
// create a subproject for parent project
- GlobalConfig.initTestConfig().then(function() {
+ GlobalConfig.initTestConfig().then(function () {
request
.post(`/project/${projectId}/subProject`)
.set('Authorization', authorization)
.send({ subProjectName: 'New SubProject' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectId = res.body[0]._id;
// sign up second user (subproject user)
- createUser(request, userData.newUser, function(
+ createUser(request, userData.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
VerificationTokenModel.findOne(
{ userId: res.body.id },
- function(
+ function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -194,7 +194,7 @@ describe('Schedule API with Sub-Projects', function() {
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
@@ -202,9 +202,9 @@ describe('Schedule API with Sub-Projects', function() {
password:
userData.newUser.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
newUserToken =
res.body.tokens
@@ -225,7 +225,7 @@ describe('Schedule API with Sub-Projects', function() {
.email,
role: 'Member',
})
- .end(function() {
+ .end(function () {
done();
});
});
@@ -237,7 +237,7 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, subProjectId] },
@@ -253,26 +253,26 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should not create a schedule for user not present in project', function(done: $TSFixMe) {
- createUser(request, userData.anotherUser, function(
+ it('should not create a schedule for user not present in project', function (done: $TSFixMe) {
+ createUser(request, userData.anotherUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
- VerificationTokenModel.findOne({ userId: res.body.id }, function(
+ VerificationTokenModel.findOne({ userId: res.body.id }, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
request
.get(`/user/confirmation/${res.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.anotherUser.email,
password: userData.anotherUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
const authorization = `Basic ${res.body.tokens.jwtAccessToken}`;
request
.post(`/schedule/${projectId}`)
@@ -280,9 +280,9 @@ describe('Schedule API with Sub-Projects', function() {
.send({
name: 'Valid Schedule',
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -296,7 +296,7 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should not create a schedule for user that is not `admin` in sub-project.', function(done: $TSFixMe) {
+ it('should not create a schedule for user that is not `admin` in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.post(`/schedule/${subProjectId}`)
@@ -304,7 +304,7 @@ describe('Schedule API with Sub-Projects', function() {
.send({
name: 'Valid Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You cannot edit the project because you're not an admin."
@@ -313,7 +313,7 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should create a schedule in parent project by valid admin.', function(done: $TSFixMe) {
+ it('should create a schedule in parent project by valid admin.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/schedule/${projectId}`)
@@ -321,7 +321,7 @@ describe('Schedule API with Sub-Projects', function() {
.send({
name: 'Valid Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
scheduleId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('Valid Schedule');
@@ -329,7 +329,7 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should create a schedule in parent project by valid admin.', function(done: $TSFixMe) {
+ it('should create a schedule in parent project by valid admin.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/schedule/${subProjectId}`)
@@ -337,7 +337,7 @@ describe('Schedule API with Sub-Projects', function() {
.send({
name: 'Valid Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
subProjectScheduleId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('Valid Schedule');
@@ -345,12 +345,12 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it("should get only sub-project's schedules for valid sub-project user", function(done: $TSFixMe) {
+ it("should get only sub-project's schedules for valid sub-project user", function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.get(`/schedule/${subProjectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -360,12 +360,12 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should get both project and sub-project schedule for valid parent project user.', function(done: $TSFixMe) {
+ it('should get both project and sub-project schedule for valid parent project user.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/schedule/${projectId}/schedules`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body[0]).to.have.property('schedules');
@@ -377,12 +377,12 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should not delete a schedule for user that is not `admin` in sub-project.', function(done: $TSFixMe) {
+ it('should not delete a schedule for user that is not `admin` in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.delete(`/schedule/${subProjectId}/${subProjectScheduleId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"You cannot edit the project because you're not an admin."
@@ -391,23 +391,23 @@ describe('Schedule API with Sub-Projects', function() {
});
});
- it('should delete sub-project schedule', function(done: $TSFixMe) {
+ it('should delete sub-project schedule', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/schedule/${subProjectId}/${subProjectScheduleId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should delete project schedule', function(done: $TSFixMe) {
+ it('should delete project schedule', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/schedule/${projectId}/${scheduleId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
diff --git a/backend/test/scheduledEvent.test.ts b/backend/test/scheduledEvent.test.ts
index db5868e240..01b3b6917f 100644
--- a/backend/test/scheduledEvent.test.ts
+++ b/backend/test/scheduledEvent.test.ts
@@ -52,35 +52,35 @@ const ongoingScheduledEvent = {
monitorDuringEvent: false,
};
-describe('Scheduled event API', function() {
+describe('Scheduled event API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
userId = res.body.id;
projectId = project._id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
ComponentModel.create({
@@ -98,9 +98,9 @@ describe('Scheduled event API', function() {
},
componentId,
})
- .end(async function(
+ .end(async function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
@@ -149,7 +149,7 @@ describe('Scheduled event API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -166,7 +166,7 @@ describe('Scheduled event API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should not create a scheduled event when the fields are null', function(done: $TSFixMe) {
+ it('should not create a scheduled event when the fields are null', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}`)
@@ -177,13 +177,13 @@ describe('Scheduled event API', function() {
endDate: '',
description: '',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create a scheduled event when a monitor is selected multiple times', function(done: $TSFixMe) {
+ it('should not create a scheduled event when a monitor is selected multiple times', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}`)
@@ -192,13 +192,13 @@ describe('Scheduled event API', function() {
...scheduledEvent,
monitors: [monitorId, monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create a scheduled event when the start date is greater than end date', function(done: $TSFixMe) {
+ it('should not create a scheduled event when the start date is greater than end date', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}`)
@@ -208,19 +208,19 @@ describe('Scheduled event API', function() {
startDate: '2019-09-11 11:01:52.178',
endDate: '2019-06-26 11:31:53.302',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create a new scheduled event when proper fields are given by an authenticated user', function(done: $TSFixMe) {
+ it('should create a new scheduled event when proper fields are given by an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}`)
.set('Authorization', authorization)
.send({ ...scheduledEvent, monitors: [monitorId] })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
scheduleEventId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal(scheduledEvent.name);
@@ -228,12 +228,12 @@ describe('Scheduled event API', function() {
});
});
- it('should get all scheduled events for a project', function(done: $TSFixMe) {
+ it('should get all scheduled events for a project', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/scheduledEvent/${projectId}/scheduledEvents/all`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
expect(res.body).to.have.length.greaterThan(0);
@@ -241,7 +241,7 @@ describe('Scheduled event API', function() {
});
});
- it('should update a scheduled event when scheduledEventId is valid', function(done: $TSFixMe) {
+ it('should update a scheduled event when scheduledEventId is valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/scheduledEvent/${projectId}/${scheduleEventId}`)
@@ -251,31 +251,31 @@ describe('Scheduled event API', function() {
name: 'updated name',
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.name).to.be.equal('updated name');
done();
});
});
- it('should delete a scheduled event when scheduledEventId is valid', function(done: $TSFixMe) {
+ it('should delete a scheduled event when scheduledEventId is valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/scheduledEvent/${projectId}/${scheduleEventId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should get first 10 scheduled events with data length 10, skip 0, limit 10 and count 12', function(done: $TSFixMe) {
+ it('should get first 10 scheduled events with data length 10, skip 0, limit 10 and count 12', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/scheduledEvent/${projectId}?skip=0&limit=10`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -297,12 +297,12 @@ describe('Scheduled event API', function() {
});
});
- it('should get 2 last scheduled events with data length 2, skip 10, limit 10 and count 12', function(done: $TSFixMe) {
+ it('should get 2 last scheduled events with data length 2, skip 10, limit 10 and count 12', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/scheduledEvent/${projectId}?skip=10&limit=10`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -324,12 +324,12 @@ describe('Scheduled event API', function() {
});
});
- it('should get 0 scheduled events with data length 0, skip 20, limit 10 and count 12', function(done: $TSFixMe) {
+ it('should get 0 scheduled events with data length 0, skip 20, limit 10 and count 12', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/scheduledEvent/${projectId}?skip=20&limit=10`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -351,18 +351,18 @@ describe('Scheduled event API', function() {
});
});
- it('should fetch an onging scheduled event', function(done: $TSFixMe) {
+ it('should fetch an onging scheduled event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}`)
.set('Authorization', authorization)
.send({ ...ongoingScheduledEvent, monitors: [monitorId] })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
scheduleEventId = res.body._id;
request
.get(`/scheduledEvent/${projectId}/ongoingEvent`)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body.data).to.be.an('array');
expect(String(res.body.data[0]._id)).to.be.equal(
@@ -374,24 +374,24 @@ describe('Scheduled event API', function() {
});
});
-describe('User from other project have access to read / write and delete API.', function() {
+describe('User from other project have access to read / write and delete API.', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
- createUser(request, userData.newUser, function(
+ createUser(request, userData.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -400,16 +400,16 @@ describe('User from other project have access to read / write and delete API.',
`/user/confirmation/${verificationToken.token}`
)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.newUser.email,
password: userData.newUser.password,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
token = res.body.tokens.jwtAccessToken;
done();
@@ -421,7 +421,7 @@ describe('User from other project have access to read / write and delete API.',
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -435,41 +435,41 @@ describe('User from other project have access to read / write and delete API.',
});
});
- it('should not be able to create new scheduled event', function(done: $TSFixMe) {
+ it('should not be able to create new scheduled event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}`)
.set('Authorization', authorization)
.send(scheduledEvent)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not be able to delete a scheduled event', function(done: $TSFixMe) {
+ it('should not be able to delete a scheduled event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/scheduledEvent/${projectId}/${scheduleEventId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not be able to get all scheduled events', function(done: $TSFixMe) {
+ it('should not be able to get all scheduled events', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/scheduledEvent/${projectId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not be able to update a scheduled event', function(done: $TSFixMe) {
+ it('should not be able to update a scheduled event', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/scheduledEvent/${projectId}/${scheduleEventId}`)
@@ -478,7 +478,7 @@ describe('User from other project have access to read / write and delete API.',
...scheduledEvent,
name: 'Name update',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
diff --git a/backend/test/scheduledEventNote.test.ts b/backend/test/scheduledEventNote.test.ts
index c69d96557e..09f7aef2da 100644
--- a/backend/test/scheduledEventNote.test.ts
+++ b/backend/test/scheduledEventNote.test.ts
@@ -64,35 +64,35 @@ const updatedInvestigationNote = {
content: 'Just updated this note',
};
-describe('Scheduled Event Note', function() {
+describe('Scheduled Event Note', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
userId = res.body.id;
projectId = project._id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
ComponentModel.create({
@@ -110,9 +110,9 @@ describe('Scheduled Event Note', function() {
},
componentId,
})
- .end(async function(
+ .end(async function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
@@ -128,9 +128,9 @@ describe('Scheduled Event Note', function() {
...scheduledEvent,
monitors: [monitorId],
})
- .end(async function(
+ .end(async function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
scheduledEventId =
res.body._id;
@@ -186,7 +186,7 @@ describe('Scheduled Event Note', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -207,7 +207,7 @@ describe('Scheduled Event Note', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should get all scheduled event notes => internal notes', function(done: $TSFixMe) {
+ it('should get all scheduled event notes => internal notes', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -215,7 +215,7 @@ describe('Scheduled Event Note', function() {
`/scheduledEvent/${projectId}/${scheduledEventId}/notes?type=internal`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.have.property('count');
expect(res.body.count).to.be.a('number');
@@ -224,7 +224,7 @@ describe('Scheduled Event Note', function() {
});
});
- it('should get first 10 scheduled event notes for data length 10, skip 0, limit 10 and count 12 => internal notes', function(done: $TSFixMe) {
+ it('should get first 10 scheduled event notes for data length 10, skip 0, limit 10 and count 12 => internal notes', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -232,7 +232,7 @@ describe('Scheduled Event Note', function() {
`/scheduledEvent/${projectId}/${scheduledEventId}/notes?type=internal&skip=0&limit=10`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -253,7 +253,7 @@ describe('Scheduled Event Note', function() {
});
});
- it('should get 2 last scheduled events notes with data length 2, skip 10, limit 10 and count 12 => internal notes', function(done: $TSFixMe) {
+ it('should get 2 last scheduled events notes with data length 2, skip 10, limit 10 and count 12 => internal notes', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -261,7 +261,7 @@ describe('Scheduled Event Note', function() {
`/scheduledEvent/${projectId}/${scheduledEventId}/notes?type=internal&skip=10&limit=10`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -282,14 +282,14 @@ describe('Scheduled Event Note', function() {
});
});
- it('should create a scheduled event note => internal note', function(done: $TSFixMe) {
+ it('should create a scheduled event note => internal note', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}/${scheduledEventId}/notes`)
.set('Authorization', authorization)
.send(internalNote)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
internalNoteId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.event_state).to.equal(internalNote.event_state);
@@ -297,14 +297,14 @@ describe('Scheduled Event Note', function() {
});
});
- it('should create a scheduled event note => investigation note', function(done: $TSFixMe) {
+ it('should create a scheduled event note => investigation note', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}/${scheduledEventId}/notes`)
.set('Authorization', authorization)
.send(investigationNote)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
investigationNoteId = res.body._id;
expect(res).to.have.status(200);
expect(res.body.content).to.equal(investigationNote.content);
@@ -312,33 +312,33 @@ describe('Scheduled Event Note', function() {
});
});
- it('should not create a scheduled event note if any of the field is missing', function(done: $TSFixMe) {
+ it('should not create a scheduled event note if any of the field is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}/${scheduledEventId}/notes`)
.set('Authorization', authorization)
.send({ ...internalNote, event_state: '' })
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
});
- it('should not creat a scheduled event note if type field is not investigation or internal', function(done: $TSFixMe) {
+ it('should not creat a scheduled event note if type field is not investigation or internal', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/scheduledEvent/${projectId}/${scheduledEventId}/notes`)
.set('Authorization', authorization)
.send({ ...internalNote, type: 'randomType' })
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
});
- it('should update a note => internal note', function(done: $TSFixMe) {
+ it('should update a note => internal note', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -347,7 +347,7 @@ describe('Scheduled Event Note', function() {
)
.set('Authorization', authorization)
.send(updatedInternalNote)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body.event_state).to.equal(
updatedInternalNote.event_state
@@ -356,7 +356,7 @@ describe('Scheduled Event Note', function() {
});
});
- it('should update a note => investigation note', function(done: $TSFixMe) {
+ it('should update a note => investigation note', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -365,7 +365,7 @@ describe('Scheduled Event Note', function() {
)
.set('Authorization', authorization)
.send(updatedInvestigationNote)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body.event_state).to.equal(
updatedInvestigationNote.event_state
@@ -374,7 +374,7 @@ describe('Scheduled Event Note', function() {
});
});
- it('should not update a note if the scheduled event note does not exist', function(done: $TSFixMe) {
+ it('should not update a note if the scheduled event note does not exist', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const noteId = projectId;
@@ -384,13 +384,13 @@ describe('Scheduled Event Note', function() {
)
.set('Authorization', authorization)
.send(updatedInternalNote)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
});
- it('should delete a scheduled event note => internal note', function(done: $TSFixMe) {
+ it('should delete a scheduled event note => internal note', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -398,14 +398,14 @@ describe('Scheduled Event Note', function() {
`/scheduledEvent/${projectId}/${scheduledEventId}/notes/${internalNoteId}`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body._id).to.equal(internalNoteId);
done();
});
});
- it('should delete a scheduled event note => investigation note', function(done: $TSFixMe) {
+ it('should delete a scheduled event note => investigation note', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
@@ -413,14 +413,14 @@ describe('Scheduled Event Note', function() {
`/scheduledEvent/${projectId}/${scheduledEventId}/notes/${investigationNoteId}`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body._id).to.equal(investigationNoteId);
done();
});
});
- it('should note delete a scheduled event note if it does not exist', function(done: $TSFixMe) {
+ it('should note delete a scheduled event note if it does not exist', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const noteId = projectId;
@@ -429,7 +429,7 @@ describe('Scheduled Event Note', function() {
`/scheduledEvent/${projectId}/${scheduledEventId}/notes/${noteId}`
)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
diff --git a/backend/test/slack.test.ts b/backend/test/slack.test.ts
index 4ffc3c9a08..343dbe476e 100644
--- a/backend/test/slack.test.ts
+++ b/backend/test/slack.test.ts
@@ -16,16 +16,16 @@ let token: $TSFixMe,
projectId: $TSFixMe;
-describe('Slack API', function() {
+describe('Slack API', function () {
this.timeout(20000);
- this.beforeAll(function(done: $TSFixMe) {
+ this.beforeAll(function (done: $TSFixMe) {
this.timeout(30000);
- GlobalConfig.initTestConfig().then(function() {
+ GlobalConfig.initTestConfig().then(function () {
request
.post('/user/signup')
.send(userData.user)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
projectId = res.body.projectId;
request
.post('/user/login')
@@ -33,7 +33,7 @@ describe('Slack API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
done();
});
@@ -41,7 +41,7 @@ describe('Slack API', function() {
});
});
- this.afterAll(async function() {
+ this.afterAll(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -56,24 +56,24 @@ describe('Slack API', function() {
// 'post /slack/:projectId/monitor'
- it('The purchase', function(done: $TSFixMe) {
+ it('The purchase', function (done: $TSFixMe) {
request
.get(`/team/${projectId}/team`)
.send({
name: 'New Schedule',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it.skip('The purchase', function(done: $TSFixMe) {
+ it.skip('The purchase', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/slack/${projectId}/:teamId`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
done();
diff --git a/backend/test/sso.test.ts b/backend/test/sso.test.ts
index fbe7581af6..ea82855d0a 100644
--- a/backend/test/sso.test.ts
+++ b/backend/test/sso.test.ts
@@ -27,38 +27,38 @@ const ssoObject = {
let token: $TSFixMe, userId: $TSFixMe;
-describe('SSO API', function() {
+describe('SSO API', function () {
this.timeout(300000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.adminUser, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.adminUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.adminUser.email,
password: userData.adminUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
UserService.updateBy(
{ _id: userId },
{ role: 'master-admin' }
- ).then(function() {
+ ).then(function () {
done();
});
});
@@ -68,7 +68,7 @@ describe('SSO API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ 'users.userId': userId });
await UserService.hardDeleteBy({
@@ -84,47 +84,47 @@ describe('SSO API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- describe('should reject requests from an unauthenticated users', function() {
- it('should reject GET requests', function(done: $TSFixMe) {
- request.get('/sso').end(function(err: $TSFixMe, res: $TSFixMe) {
+ describe('should reject requests from an unauthenticated users', function () {
+ it('should reject GET requests', function (done: $TSFixMe) {
+ request.get('/sso').end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject POST requests', function(done: $TSFixMe) {
- request.post('/sso').end(function(err: $TSFixMe, res: $TSFixMe) {
+ it('should reject POST requests', function (done: $TSFixMe) {
+ request.post('/sso').end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject PUT requests', function(done: $TSFixMe) {
+ it('should reject PUT requests', function (done: $TSFixMe) {
request
.put('/sso/5ea951228877984ea9f47660')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject DELETE requests', function(done: $TSFixMe) {
+ it('should reject DELETE requests', function (done: $TSFixMe) {
request
.delete('/sso/5ea951228877984ea9f47660')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
});
- describe('GET /sso/', function() {
- it('should return SSOs list with count', function(done: $TSFixMe) {
+ describe('GET /sso/', function () {
+ it('should return SSOs list with count', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/sso')
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -133,12 +133,12 @@ describe('SSO API', function() {
});
});
- it('should return SSOs list with count, skip and limit (when skip&limit specified)', function(done: $TSFixMe) {
+ it('should return SSOs list with count, skip and limit (when skip&limit specified)', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/sso?limit=10&skip=0')
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -150,14 +150,14 @@ describe('SSO API', function() {
});
});
- describe('POST /sso', function() {
- it('should create a new SSO', function(done: $TSFixMe) {
+ describe('POST /sso', function () {
+ it('should create a new SSO', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post('/sso')
.set('Authorization', authorization)
.send(ssoObject)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('_id');
@@ -180,7 +180,7 @@ describe('SSO API', function() {
});
});
- it('should not create a new SSO if domaine is not defined', function(done: $TSFixMe) {
+ it('should not create a new SSO if domaine is not defined', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...ssoObject };
@@ -190,13 +190,13 @@ describe('SSO API', function() {
.post('/sso')
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create a new SSO if Saml SSO url is not defined', function(done: $TSFixMe) {
+ it('should not create a new SSO if Saml SSO url is not defined', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...ssoObject };
@@ -206,13 +206,13 @@ describe('SSO API', function() {
.post('/sso')
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not create a new SSO if remote logout url is not defined', function(done: $TSFixMe) {
+ it('should not create a new SSO if remote logout url is not defined', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...ssoObject };
@@ -222,22 +222,22 @@ describe('SSO API', function() {
.post('/sso')
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
});
- describe('DELETE /sso', function() {
- it('should delete sso', function(done: $TSFixMe) {
+ describe('DELETE /sso', function () {
+ it('should delete sso', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
SsoService.create(ssoObject).then(sso => {
const { _id: ssoId } = sso;
request
.delete(`/sso/${ssoId}`)
.set('Authorization', authorization)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('_id');
@@ -259,8 +259,8 @@ describe('SSO API', function() {
});
});
- describe('UPDATE /sso', function() {
- it('should update SSO', function(done: $TSFixMe) {
+ describe('UPDATE /sso', function () {
+ it('should update SSO', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
SsoService.create(ssoObject).then(sso => {
const { _id: ssoId } = sso;
@@ -273,7 +273,7 @@ describe('SSO API', function() {
.put(`/sso/${ssoId}`)
.set('Authorization', authorization)
.send(updatedSsoObject)
- .end(async function(err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body[0]).to.be.an('object');
expect(res.body[0].domain).to.equal(
diff --git a/backend/test/statusPage.test.ts b/backend/test/statusPage.test.ts
index de5fe023d1..333ae30c22 100644
--- a/backend/test/statusPage.test.ts
+++ b/backend/test/statusPage.test.ts
@@ -60,21 +60,21 @@ const scheduledEvent = {
monitorDuringEvent: false,
};
-describe('Status API', function() {
+describe('Status API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(async function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(async function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
if (err) throw err;
projectId = res.body.project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe
) {
if (err) throw err;
@@ -84,7 +84,7 @@ describe('Status API', function() {
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
@@ -92,7 +92,7 @@ describe('Status API', function() {
.post(`/resourceCategory/${projectId}`)
.set('Authorization', authorization)
.send(resourceCategory)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
resourceCategoryId = res.body._id;
@@ -108,9 +108,9 @@ describe('Status API', function() {
...monitor,
componentId,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
if (err) throw err;
monitorId = res.body._id;
@@ -127,9 +127,9 @@ describe('Status API', function() {
authorization
)
.send(scheduledEvent)
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
if (err) throw err;
scheduledEventId =
@@ -148,7 +148,7 @@ describe('Status API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await MonitorService.hardDeleteBy({ _id: monitorId });
await ScheduledEventService.hardDeleteBy({ _id: scheduledEventId });
@@ -157,7 +157,7 @@ describe('Status API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should not add status page if the page name is missing', function(done: $TSFixMe) {
+ it('should not add status page if the page name is missing', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/status-page/${projectId}`)
@@ -169,14 +169,14 @@ describe('Status API', function() {
copyright: 'status copyright',
projectId,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
});
});
- it('should add status page', function(done: $TSFixMe) {
+ it('should add status page', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/status-page/${projectId}`)
@@ -202,7 +202,7 @@ describe('Status API', function() {
},
],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
statusPageId = res.body._id;
expect(res).to.have.status(200);
@@ -211,7 +211,7 @@ describe('Status API', function() {
});
});
- it('should add private status page', function(done: $TSFixMe) {
+ it('should add private status page', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/status-page/${projectId}`)
@@ -238,7 +238,7 @@ describe('Status API', function() {
},
],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
privateStatusPageId = res.body._id;
expect(res).to.have.status(200);
@@ -249,12 +249,12 @@ describe('Status API', function() {
});
});
- it('should get private status page for authorized user', function(done: $TSFixMe) {
+ it('should get private status page for authorized user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/status-page/${privateStatusPageId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -262,29 +262,29 @@ describe('Status API', function() {
});
});
- it('should get valid private status page rss for authorized user', function(done: $TSFixMe) {
+ it('should get valid private status page rss for authorized user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/status-page/${privateStatusPageId}/rss`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
});
});
- it('should not get private status page for unauthorized user', function(done: $TSFixMe) {
+ it('should not get private status page for unauthorized user', function (done: $TSFixMe) {
request
.get(`/status-page/${privateStatusPageId}`)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(401);
done();
});
});
- it('should not update status page settings when domain is not string', function(done: $TSFixMe) {
+ it('should not update status page settings when domain is not string', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
@@ -292,14 +292,14 @@ describe('Status API', function() {
.send({
domain: 5,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
});
});
- it('should not update status page settings when domain is not valid', function(done: $TSFixMe) {
+ it('should not update status page settings when domain is not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
@@ -307,14 +307,14 @@ describe('Status API', function() {
.send({
domain: 'wwwtest',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
});
});
- it('should update status page settings', function(done: $TSFixMe) {
+ it('should update status page settings', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put(`/status-page/${projectId}`)
@@ -341,20 +341,20 @@ describe('Status API', function() {
},
],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
});
});
- it('should return monitor category with monitors in status page data', function(done: $TSFixMe) {
+ it('should return monitor category with monitors in status page data', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/status-page/${statusPageId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res).to.be.an('object');
@@ -372,13 +372,13 @@ describe('Status API', function() {
});
});
- it('should get list of scheduled events', function(done: $TSFixMe) {
+ it('should get list of scheduled events', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/status-page/${projectId}/${statusPageId}/events`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res).to.be.an('object');
@@ -391,7 +391,7 @@ describe('Status API', function() {
});
});
- it('should get list of scheduled events for monitor', function(done: $TSFixMe) {
+ it('should get list of scheduled events for monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(
@@ -399,7 +399,7 @@ describe('Status API', function() {
)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res).to.be.an('object');
@@ -412,7 +412,7 @@ describe('Status API', function() {
});
});
- it('should get list of logs for a monitor', function(done: $TSFixMe) {
+ it('should get list of logs for a monitor', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
monitorLogService
.create({
@@ -429,7 +429,7 @@ describe('Status API', function() {
.send({
responseTime: true,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res).to.be.an('object');
@@ -440,28 +440,28 @@ describe('Status API', function() {
});
});
- it('should create a domain', function(done: $TSFixMe) {
+ it('should create a domain', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'oneuptimeapp.com' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
});
});
- it('should create a domain with subdomain', function(done: $TSFixMe) {
+ it('should create a domain with subdomain', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'status.oneuptimeapp.com' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
@@ -471,7 +471,7 @@ describe('Status API', function() {
// The placement of this test case is very important
// a domain needs to be created before verifying it
- it('should verify a domain', function(done: $TSFixMe) {
+ it('should verify a domain', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const domain = 'oneuptimeapp.com';
const verificationToken = 'm2ab5osUmz9Y7Ko';
@@ -479,12 +479,12 @@ describe('Status API', function() {
DomainVerificationService.updateOneBy(
{ domain },
{ verificationToken }
- ).then(function({ _id: domainId, verificationToken }) {
+ ).then(function ({ _id: domainId, verificationToken }) {
request
.put(`/domainVerificationToken/${projectId}/verify/${domainId}`)
.set('Authorization', authorization)
.send({ domain, verificationToken })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res.body.verified).to.be.true;
@@ -493,14 +493,14 @@ describe('Status API', function() {
});
});
- it('should verify a domain and fetch a status page', function(done: $TSFixMe) {
+ it('should verify a domain and fetch a status page', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'status.x.com' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
const domain = 'status.x.com';
@@ -508,11 +508,11 @@ describe('Status API', function() {
DomainVerificationService.updateOneBy(
{ domain },
{ verified: true }
- ).then(function() {
+ ).then(function () {
request
.get(`/status-page/null?url=${domain}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res.body._id).to.be.equal(statusPageId);
@@ -522,21 +522,21 @@ describe('Status API', function() {
});
});
- it('should NOT fetch status page of unverfied domain', function(done: $TSFixMe) {
+ it('should NOT fetch status page of unverfied domain', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'status.y.com' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
const domain = 'status.y.com';
request
.get(`/status-page/null?url=${domain}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -547,7 +547,7 @@ describe('Status API', function() {
});
});
- it('should not verify a domain if txt record is not found', function(done: $TSFixMe) {
+ it('should not verify a domain if txt record is not found', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const domain = 'oneuptimeapp.com';
const verificationToken = 'thistokenwillnotwork';
@@ -555,12 +555,12 @@ describe('Status API', function() {
DomainVerificationService.updateOneBy(
{ domain },
{ verificationToken, verified: false, verifiedAt: null }
- ).then(function({ _id: domainId, verificationToken }) {
+ ).then(function ({ _id: domainId, verificationToken }) {
request
.put(`/domainVerificationToken/${projectId}/verify/${domainId}`)
.set('Authorization', authorization)
.send({ domain, verificationToken })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -568,7 +568,7 @@ describe('Status API', function() {
});
});
- it('should not verify a domain that does not exist on the web', function(done: $TSFixMe) {
+ it('should not verify a domain that does not exist on the web', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const domain = 'binoehty1234hgyt.com';
const selectDomainVerify =
@@ -578,19 +578,19 @@ describe('Status API', function() {
];
StatusService.createDomain(domain, projectId, statusPageId).then(
- function() {
+ function () {
DomainVerificationService.findOneBy({
query: { domain },
select: selectDomainVerify,
populate: populateDomainVerify,
- }).then(function({ domain, verificationToken, _id: domainId }) {
+ }).then(function ({ domain, verificationToken, _id: domainId }) {
request
.put(
`/domainVerificationToken/${projectId}/verify/${domainId}`
)
.set('Authorization', authorization)
.send({ domain, verificationToken })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -600,14 +600,14 @@ describe('Status API', function() {
);
});
- it('should not save domain if domain is invalid', function(done: $TSFixMe) {
+ it('should not save domain if domain is invalid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'status.oneuptime.hackerbay' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -617,7 +617,7 @@ describe('Status API', function() {
// this is no longer the case
// array of domain are no longer used in the application
- it.skip('should save an array of valid domains', function(done: $TSFixMe) {
+ it.skip('should save an array of valid domains', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
domain: [
@@ -629,7 +629,7 @@ describe('Status API', function() {
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
@@ -639,7 +639,7 @@ describe('Status API', function() {
// this is no longer the case
// array of domain are no longer used in the application
- it.skip('should not save domains if one domain in the array is invalid', function(done: $TSFixMe) {
+ it.skip('should not save domains if one domain in the array is invalid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = {
domain: [
@@ -651,35 +651,35 @@ describe('Status API', function() {
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
});
});
- it('should save when domain is without subdomain', function(done: $TSFixMe) {
+ it('should save when domain is without subdomain', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'oneuptime.com' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
});
});
- it('should reject adding an existing domain', function(done: $TSFixMe) {
+ it('should reject adding an existing domain', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'status.oneuptimeapp.com' };
request
.put(`/status-page/${projectId}/${statusPageId}/domain`)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -689,14 +689,14 @@ describe('Status API', function() {
// This test will work base on the fact that a domain was previously created in another project
// This test will try to create another domain with the same domain on another project
- it('should add domain if it exist in another project and if the domain in other project is NOT verified.', function(done: $TSFixMe) {
+ it('should add domain if it exist in another project and if the domain in other project is NOT verified.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'oneuptimeapp.com' };
request
.post(`/project/create`)
.set('Authorization', authorization)
.send(project.newProject)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
const newProjectId = res.body._id;
request
@@ -711,7 +711,7 @@ describe('Status API', function() {
projectId,
monitorIds: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
const newStatusPageId = res.body._id;
request
@@ -720,7 +720,7 @@ describe('Status API', function() {
)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(
@@ -735,14 +735,14 @@ describe('Status API', function() {
});
});
- it('should NOT add domain if it exist in another project and domain in other project is verified', function(done: $TSFixMe) {
+ it('should NOT add domain if it exist in another project and domain in other project is verified', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'status.x.com' };
request
.post(`/project/create`)
.set('Authorization', authorization)
.send(project.newSecondProject)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
const newProjectId = res.body._id;
request
@@ -757,7 +757,7 @@ describe('Status API', function() {
projectId,
monitorIds: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
const newStatusPageId = res.body._id;
request
@@ -766,7 +766,7 @@ describe('Status API', function() {
)
.set('Authorization', authorization)
.send(data)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
expect(res.body.message).to.be.equals(
@@ -782,7 +782,7 @@ describe('Status API', function() {
// check for when the domain in statuspage is updated
// check for when domainverificationtoken is updated
- it('should update a domain on a status page successfully', function(done: $TSFixMe) {
+ it('should update a domain on a status page successfully', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: 'app.oneuptimeapp.com' };
@@ -794,7 +794,7 @@ describe('Status API', function() {
.put(`/status-page/${projectId}/${statusPageId}/${domainId}`)
.send(data)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
if (err) throw err;
expect(res).to.have.status(200);
done();
@@ -802,7 +802,7 @@ describe('Status API', function() {
});
});
- it('should not update a domain on a status page if the domain field is empty', function(done: $TSFixMe) {
+ it('should not update a domain on a status page if the domain field is empty', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: '' };
@@ -814,7 +814,7 @@ describe('Status API', function() {
.put(`/status-page/${projectId}/${statusPageId}/${domainId}`)
.send(data)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -822,7 +822,7 @@ describe('Status API', function() {
});
});
- it('should not update a domain on a status page if the domain is not a string', function(done: $TSFixMe) {
+ it('should not update a domain on a status page if the domain is not a string', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: { url: 'shop.oneuptimeapp.com' } };
@@ -834,7 +834,7 @@ describe('Status API', function() {
.put(`/status-page/${projectId}/${statusPageId}/${domainId}`)
.send(data)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -842,7 +842,7 @@ describe('Status API', function() {
});
});
- it('should not update a domain on a status page if the status page is missing or not found', function(done: $TSFixMe) {
+ it('should not update a domain on a status page if the status page is missing or not found', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const data = { domain: { url: 'shop.oneuptimeapp.com' } };
@@ -856,7 +856,7 @@ describe('Status API', function() {
.put(`/status-page/${projectId}/${statusPageId}/${domainId}`)
.send(data)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -864,7 +864,7 @@ describe('Status API', function() {
});
});
- it('should delete a domain from a status page', function(done: $TSFixMe) {
+ it('should delete a domain from a status page', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
StatusService.findOneBy({ _id: statusPageId }).then(statusPage => {
// select the first domain
@@ -873,7 +873,7 @@ describe('Status API', function() {
request
.delete(`/status-page/${projectId}/${statusPageId}/${domainId}`)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
if (err) throw err;
expect(res).to.have.status(200);
done();
@@ -881,7 +881,7 @@ describe('Status API', function() {
});
});
- it('should not delete any domain if status page does not exist or not found', function(done: $TSFixMe) {
+ it('should not delete any domain if status page does not exist or not found', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
StatusService.findOneBy({ _id: statusPageId }).then(statusPage => {
// select the first domain
@@ -892,7 +892,7 @@ describe('Status API', function() {
request
.delete(`/status-page/${projectId}/${statusPageId}/${domainId}`)
.set('Authorization', authorization)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
if (err) throw err;
expect(res).to.have.status(400);
done();
@@ -907,30 +907,30 @@ let subProjectId: $TSFixMe,
anotherUserToken: $TSFixMe,
subProjectStatusPageId: $TSFixMe;
-describe('StatusPage API with Sub-Projects', function() {
+describe('StatusPage API with Sub-Projects', function () {
this.timeout(30000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(30000);
const authorization = `Basic ${token}`;
- GlobalConfig.initTestConfig().then(function() {
+ GlobalConfig.initTestConfig().then(function () {
// create a subproject for parent project
request
.post(`/project/${projectId}/subProject`)
.set('Authorization', authorization)
.send({ subProjectName: 'New SubProject' })
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
subProjectId = res.body[0]._id;
// sign up second user (subproject user)
- createUser(request, userData.newUser, function() {
+ createUser(request, userData.newUser, function () {
request
.post('/user/login')
.send({
email: userData.newUser.email,
password: userData.newUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
newUserToken = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
@@ -942,7 +942,7 @@ describe('StatusPage API with Sub-Projects', function() {
emails: userData.newUser.email,
role: 'Member',
})
- .end(function() {
+ .end(function () {
done();
});
});
@@ -951,7 +951,7 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- after(async function() {
+ after(async function () {
await ProjectService.hardDeleteBy({
_id: { $in: [projectId, subProjectId] },
});
@@ -967,15 +967,15 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should not create a statupage for user not present in project', function(done: $TSFixMe) {
- createUser(request, userData.anotherUser, function() {
+ it('should not create a statupage for user not present in project', function (done: $TSFixMe) {
+ createUser(request, userData.anotherUser, function () {
request
.post('/user/login')
.send({
email: userData.anotherUser.email,
password: userData.anotherUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
anotherUserToken = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${anotherUserToken}`;
@@ -1002,7 +1002,7 @@ describe('StatusPage API with Sub-Projects', function() {
},
],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -1014,19 +1014,19 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should not get private status page for authorized user that is not in project', function(done: $TSFixMe) {
+ it('should not get private status page for authorized user that is not in project', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.get(`/status-page/${privateStatusPageId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
done();
});
});
- it('should not create a statusPage for user that is not `admin` in sub-project.', function(done: $TSFixMe) {
+ it('should not create a statusPage for user that is not `admin` in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.post(`/status-page/${subProjectId}`)
@@ -1051,7 +1051,7 @@ describe('StatusPage API with Sub-Projects', function() {
},
],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -1061,7 +1061,7 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should create a statusPage in parent project by valid admin.', function(done: $TSFixMe) {
+ it('should create a statusPage in parent project by valid admin.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/status-page/${projectId}`)
@@ -1088,7 +1088,7 @@ describe('StatusPage API with Sub-Projects', function() {
],
domains: [],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
statusPageId = res.body._id;
expect(res).to.have.status(200);
@@ -1097,7 +1097,7 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should create a statusPage in sub-project by valid admin.', function(done: $TSFixMe) {
+ it('should create a statusPage in sub-project by valid admin.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/status-page/${subProjectId}`)
@@ -1123,7 +1123,7 @@ describe('StatusPage API with Sub-Projects', function() {
},
],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
subProjectStatusPageId = res.body._id;
expect(res).to.have.status(200);
@@ -1132,12 +1132,12 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it("should get only sub-project's statuspages for valid sub-project user", function(done: $TSFixMe) {
+ it("should get only sub-project's statuspages for valid sub-project user", function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.get(`/status-page/${subProjectId}/statuspage`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -1148,12 +1148,12 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should get both project and sub-project statuspage for valid parent project user.', function(done: $TSFixMe) {
+ it('should get both project and sub-project statuspage for valid parent project user.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/status-page/${projectId}/statuspages`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
@@ -1166,7 +1166,7 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should get status page for viewer in sub-project', function(done: $TSFixMe) {
+ it('should get status page for viewer in sub-project', function (done: $TSFixMe) {
const authorization = `Basic ${anotherUserToken}`;
request
.post(`/team/${subProjectId}`)
@@ -1175,11 +1175,11 @@ describe('StatusPage API with Sub-Projects', function() {
emails: userData.anotherUser.email,
role: 'Viewer',
})
- .end(function() {
+ .end(function () {
request
.get(`/status-page/${subProjectStatusPageId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
@@ -1189,12 +1189,12 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should not delete a status page for user that is not `admin` in sub-project.', function(done: $TSFixMe) {
+ it('should not delete a status page for user that is not `admin` in sub-project.', function (done: $TSFixMe) {
const authorization = `Basic ${newUserToken}`;
request
.delete(`/status-page/${subProjectId}/${subProjectStatusPageId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
@@ -1204,24 +1204,24 @@ describe('StatusPage API with Sub-Projects', function() {
});
});
- it('should delete sub-project status page', function(done: $TSFixMe) {
+ it('should delete sub-project status page', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/status-page/${subProjectId}/${subProjectStatusPageId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
});
});
- it('should delete parent project status page', function(done: $TSFixMe) {
+ it('should delete parent project status page', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/status-page/${projectId}/${statusPageId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) throw err;
expect(res).to.have.status(200);
done();
diff --git a/backend/test/stripe.test.ts b/backend/test/stripe.test.ts
index 1fa745952b..0cbac9a0f3 100644
--- a/backend/test/stripe.test.ts
+++ b/backend/test/stripe.test.ts
@@ -21,35 +21,35 @@ import VerificationTokenModel from '../backend/models/verificationToken';
let cardId: $TSFixMe, authorization: $TSFixMe;
-describe('Stripe payment API', function() {
+describe('Stripe payment API', function () {
this.timeout(50000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
authorization = `Basic ${token}`;
done();
@@ -60,7 +60,7 @@ describe('Stripe payment API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -75,11 +75,11 @@ describe('Stripe payment API', function() {
await AirtableService.deleteAll({ tableName: 'User' });
});
- it('should sign up and a transaction of 1 $ should be made', function(done: $TSFixMe) {
+ it('should sign up and a transaction of 1 $ should be made', function (done: $TSFixMe) {
request
.get(`/stripe/${userId}/charges`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -93,11 +93,11 @@ describe('Stripe payment API', function() {
});
});
- it('should return payment intent when valid details are passed ', function(done: $TSFixMe) {
+ it('should return payment intent when valid details are passed ', function (done: $TSFixMe) {
request
.post(`/stripe/${userId}/creditCard/${'tok_amex'}/pi`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
cardId = res.body.source;
expect(res).to.have.status(200);
expect(res.body).to.have.property('id');
@@ -109,11 +109,11 @@ describe('Stripe payment API', function() {
});
});
- it('should return 2 cards attached to customer', function(done: $TSFixMe) {
+ it('should return 2 cards attached to customer', function (done: $TSFixMe) {
request
.get(`/stripe/${userId}/creditCard`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -122,11 +122,11 @@ describe('Stripe payment API', function() {
});
});
- it('should update default card for customer', function(done: $TSFixMe) {
+ it('should update default card for customer', function (done: $TSFixMe) {
request
.put(`/stripe/${userId}/creditCard/${cardId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('default_source');
@@ -135,11 +135,11 @@ describe('Stripe payment API', function() {
});
});
- it('should return 2 cards attached to customer', function(done: $TSFixMe) {
+ it('should return 2 cards attached to customer', function (done: $TSFixMe) {
request
.get(`/stripe/${userId}/creditCard`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('data');
expect(res.body.data).to.be.an('array');
@@ -148,11 +148,11 @@ describe('Stripe payment API', function() {
});
});
- it('should fetch a single card', function(done: $TSFixMe) {
+ it('should fetch a single card', function (done: $TSFixMe) {
request
.get(`/stripe/${userId}/creditCard/${cardId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('id');
@@ -163,11 +163,11 @@ describe('Stripe payment API', function() {
});
});
- it('should delete a card', function(done: $TSFixMe) {
+ it('should delete a card', function (done: $TSFixMe) {
request
.delete(`/stripe/${userId}/creditCard/${cardId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('id');
@@ -176,16 +176,16 @@ describe('Stripe payment API', function() {
});
});
- it('should not delete a single left card', function(done: $TSFixMe) {
+ it('should not delete a single left card', function (done: $TSFixMe) {
request
.get(`/stripe/${userId}/creditCard`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
cardId = res.body.data[0].id;
request
.delete(`/stripe/${userId}/creditCard/${cardId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(403);
expect(res.body.message).to.be.equal(
'Cannot delete the only card'
@@ -195,11 +195,11 @@ describe('Stripe payment API', function() {
});
});
- it('should not create a payment intent when token(generated from client) is invalid', function(done: $TSFixMe) {
+ it('should not create a payment intent when token(generated from client) is invalid', function (done: $TSFixMe) {
request
.post(`/stripe/${userId}/creditCard/${'tok_invalid'}/pi`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
"No such token: 'tok_invalid'"
@@ -208,14 +208,14 @@ describe('Stripe payment API', function() {
});
});
- it('should not add balance to customer accounts if rechargeBalanceAmount is not a valid integer', function(done: $TSFixMe) {
+ it('should not add balance to customer accounts if rechargeBalanceAmount is not a valid integer', function (done: $TSFixMe) {
request
.post(`/stripe/${projectId}/addBalance`)
.set('Authorization', authorization)
.send({
rechargeBalanceAmount: '43_',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
expect(res.body.message).to.be.equal(
'Amount should be present and it should be a valid number.'
@@ -224,14 +224,14 @@ describe('Stripe payment API', function() {
});
});
- it('should return payment intent if rechargeBalanceAmount is a valid integer', function(done: $TSFixMe) {
+ it('should return payment intent if rechargeBalanceAmount is a valid integer', function (done: $TSFixMe) {
request
.post(`/stripe/${projectId}/addBalance`)
.set('Authorization', authorization)
.send({
rechargeBalanceAmount: '100',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.have.property('id');
expect(res.body).to.have.property('client_secret');
diff --git a/backend/test/subscriber.test.ts b/backend/test/subscriber.test.ts
index 4c8ac5ef9a..2ad09e0e13 100644
--- a/backend/test/subscriber.test.ts
+++ b/backend/test/subscriber.test.ts
@@ -55,34 +55,34 @@ const csvData = {
],
};
-describe('Subscriber API', function() {
+describe('Subscriber API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
projectId = res.body.project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
ComponentModel.create({
@@ -96,9 +96,9 @@ describe('Subscriber API', function() {
...monitor,
componentId,
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
expect(
@@ -123,9 +123,9 @@ describe('Subscriber API', function() {
projectId,
monitorIds: [monitorId],
})
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
statusPageId =
res.body._id;
@@ -175,7 +175,7 @@ describe('Subscriber API', function() {
method: 'email',
},
})
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
subscriberId = res.body[0]._id;
expect(res).to.have.status(200);
expect(res.body).to.be.an('array');
@@ -192,7 +192,7 @@ describe('Subscriber API', function() {
.send({
monitorIds: monitorId,
})
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
@@ -201,7 +201,7 @@ describe('Subscriber API', function() {
it('should get list of subscribers to a project', (done: $TSFixMe) => {
request
.get(`/subscriber/${projectId}`)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -213,7 +213,7 @@ describe('Subscriber API', function() {
it('should get list of subscribers to a monitorId', (done: $TSFixMe) => {
request
.get(`/subscriber/${projectId}/monitor/${monitorId}`)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -225,19 +225,19 @@ describe('Subscriber API', function() {
it('should get a subscriber', (done: $TSFixMe) => {
request
.get(`/subscriber/${projectId}/${subscriberId}`)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
});
});
- it('should delete a subscriber', function(done: $TSFixMe) {
+ it('should delete a subscriber', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/subscriber/${projectId}/${subscriberId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
@@ -247,7 +247,7 @@ describe('Subscriber API', function() {
request
.post(`/subscriber/${projectId}/${monitorId}/csv`)
.send(csvData)
- .end((_err: $TSFixMe, res: $TSFixMe) => {
+ .end((_err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.have.lengthOf(2);
expect(res.body[0]).to.have.property('_id');
@@ -260,7 +260,7 @@ describe('Subscriber API', function() {
request
.post(`/subscriber/${projectId}/${monitorId}/csv`)
.send(csvData)
- .end((_err: $TSFixMe, res: $TSFixMe) => {
+ .end((_err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body[0]).to.not.have.property('_id');
expect(res.body[0]).to.not.have.property('projectId');
@@ -279,7 +279,7 @@ describe('Subscriber API', function() {
request
.post(`/subscriber/${projectId}/${monitorId}/csv`)
.send(csvData)
- .end((_err: $TSFixMe, res: $TSFixMe) => {
+ .end((_err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body[0]).to.not.have.property('_id');
expect(res.body[0]).to.not.have.property('projectId');
@@ -296,7 +296,7 @@ describe('Subscriber API', function() {
request
.post(`/subscriber/${projectId}/${monitorId}/csv`)
.send(csvData)
- .end((_err: $TSFixMe, res: $TSFixMe) => {
+ .end((_err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
expect(res.body.message).to.equal('Empty files submitted');
done();
diff --git a/backend/test/subscriberAlert.test.ts b/backend/test/subscriberAlert.test.ts
index 3b88ec4064..96c52b9a90 100644
--- a/backend/test/subscriberAlert.test.ts
+++ b/backend/test/subscriberAlert.test.ts
@@ -37,43 +37,43 @@ const monitor = {
data: { url: 'http://www.tests.org' },
};
-describe('Subcriber Alert API', function() {
+describe('Subcriber Alert API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
projectId = res.body.project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
.set('Authorization', authorization)
.send(monitor)
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
incidentData.monitors = [monitorId];
@@ -89,7 +89,7 @@ describe('Subcriber Alert API', function() {
.end(
(
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) => {
idNumber =
res.body.idNumber; // This has replaced incidentId and is used to query subscriber alert
@@ -142,7 +142,7 @@ describe('Subcriber Alert API', function() {
.post(`/emailSmtp/${projectId}`)
.set('Authorization', authorization)
.send(smtpCredentials)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
request
.post(
@@ -152,7 +152,7 @@ describe('Subcriber Alert API', function() {
alertVia: 'email',
contactEmail: userData.user.email,
})
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
subscriberId = res.body._id;
request
.post(
@@ -163,7 +163,7 @@ describe('Subcriber Alert API', function() {
alertVia: 'email',
eventType: 'identified',
})
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body.alertVia).to.be.equal(
@@ -188,7 +188,7 @@ describe('Subcriber Alert API', function() {
alertVia: null,
eventType: 'identified',
})
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(400);
done();
});
@@ -197,7 +197,7 @@ describe('Subcriber Alert API', function() {
it('should get subscriber alerts by projectId', (done: $TSFixMe) => {
request
.get(`/subscriberAlert/${projectId}`)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -209,7 +209,7 @@ describe('Subcriber Alert API', function() {
it('should get subscriber alerts by incidentId', (done: $TSFixMe) => {
request
.get(`/subscriberAlert/${projectId}/incident/${idNumber}`)
- .end((err: $TSFixMe, res: $TSFixMe) => {
+ .end((err: $TSFixMe, req: Response) => {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
done();
diff --git a/backend/test/user.test.ts b/backend/test/user.test.ts
index eac6176cc1..def2004685 100644
--- a/backend/test/user.test.ts
+++ b/backend/test/user.test.ts
@@ -27,15 +27,15 @@ import { fetchIdpSAMLResponse } from './utils/test-utils';
let projectId: $TSFixMe, userId: $TSFixMe, token: $TSFixMe;
const deleteAccountConfirmation = { deleteMyAccount: 'DELETE MY ACCOUNT' };
-describe('User API', function() {
+describe('User API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, data.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, data.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
if (err) {
throw err;
@@ -44,7 +44,7 @@ describe('User API', function() {
projectId = project._id;
userId = res.body.id;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
@@ -54,14 +54,14 @@ describe('User API', function() {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: data.user.email,
password: data.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
if (err) {
throw err;
}
@@ -92,10 +92,10 @@ describe('User API', function() {
// 'post /user/signup'
- it('should register with name, email, password, companyName, jobRole, referral, companySize, stripeToken, stripePlanId', function(done: $TSFixMe) {
- createUser(request, data.newUser, function(
+ it('should register with name, email, password, companyName, jobRole, referral, companySize, stripeToken, stripePlanId', function (done: $TSFixMe) {
+ createUser(request, data.newUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(200);
expect(res.body.email).to.equal(data.newUser.email);
@@ -103,41 +103,41 @@ describe('User API', function() {
});
});
- it('should not register when name, email, password, companyName, jobRole, referral, companySize, stripePlanId or stripeToken is null', function(done: $TSFixMe) {
- createUser(request, data.nullUser, function(
+ it('should not register when name, email, password, companyName, jobRole, referral, companySize, stripePlanId or stripeToken is null', function (done: $TSFixMe) {
+ createUser(request, data.nullUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
done();
});
});
- it('should not register with same email', function(done: $TSFixMe) {
- createUser(request, data.user, function(err: $TSFixMe, res: $TSFixMe) {
+ it('should not register with same email', function (done: $TSFixMe) {
+ createUser(request, data.user, function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not register with an invalid email', function(done: $TSFixMe) {
+ it('should not register with an invalid email', function (done: $TSFixMe) {
const invalidMailUser = Object.assign({}, data.user);
invalidMailUser.email = 'invalidMail';
- createUser(request, invalidMailUser, function(
+ createUser(request, invalidMailUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
done();
});
});
- it('should not register with a personal email', function(done: $TSFixMe) {
+ it('should not register with a personal email', function (done: $TSFixMe) {
const personalMailUser = Object.assign({}, data.user);
personalMailUser.email = 'personalAccount@gmail.com';
- createUser(request, personalMailUser, function(
+ createUser(request, personalMailUser, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(400);
done();
@@ -146,14 +146,14 @@ describe('User API', function() {
// post '/user/login'
- it('should not login when email is null', function(done: $TSFixMe) {
+ it('should not login when email is null', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: null,
password: data.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
@@ -161,46 +161,46 @@ describe('User API', function() {
// post '/user/login'
- it('should not login when password is null', function(done: $TSFixMe) {
+ it('should not login when password is null', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: data.user.email,
password: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not allow to login with invalid email', function(done: $TSFixMe) {
+ it('should not allow to login with invalid email', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: 'invalidEmail',
password: data.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not allow to login with invalid password', function(done: $TSFixMe) {
+ it('should not allow to login with invalid password', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: data.user.email,
password: {},
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should track IP and other parameters when login in', async function() {
+ it('should track IP and other parameters when login in', async function () {
const res = await request.post('/user/login').send({
email: data.user.email,
password: data.user.password,
@@ -214,14 +214,14 @@ describe('User API', function() {
expect(log.ipLocation.ip).to.be.equal('::ffff:127.0.0.1');
});
- it('should login with valid credentials', function(done: $TSFixMe) {
+ it('should login with valid credentials', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
email: data.newUser.email,
password: data.newUser.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.email).to.equal(data.newUser.email);
expect(res.body).include.keys('tokens');
@@ -229,7 +229,7 @@ describe('User API', function() {
});
});
- it('should login with valid credentials, and return sent redirect url', function(done: $TSFixMe) {
+ it('should login with valid credentials, and return sent redirect url', function (done: $TSFixMe) {
request
.post('/user/login')
.send({
@@ -237,7 +237,7 @@ describe('User API', function() {
password: data.newUser.password,
redirect: 'http://oneuptime.com',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.email).to.equal(data.newUser.email);
expect(res.body).have.property('redirect');
@@ -246,37 +246,37 @@ describe('User API', function() {
});
});
- it('should not accept `/forgot-password` request when email is null', function(done: $TSFixMe) {
+ it('should not accept `/forgot-password` request when email is null', function (done: $TSFixMe) {
request
.post('/user/forgot-password')
.send({
email: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not accept `/forgot-password` request when email is invalid', function(done: $TSFixMe) {
+ it('should not accept `/forgot-password` request when email is invalid', function (done: $TSFixMe) {
request
.post('/user/forgot-password')
.send({
email: '(' + data.user.email + ')',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should accept `/forgot-password` request when email is valid', function(done: $TSFixMe) {
+ it('should accept `/forgot-password` request when email is valid', function (done: $TSFixMe) {
request
.post('/user/forgot-password')
.send({
email: data.newUser.email,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
@@ -284,14 +284,14 @@ describe('User API', function() {
// post '/user/reset-password'
- it('should not accept `/user/reset-password` request when token is null', function(done: $TSFixMe) {
+ it('should not accept `/user/reset-password` request when token is null', function (done: $TSFixMe) {
request
.post('/user/reset-password')
.send({
password: data.user.password,
token: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
@@ -299,27 +299,27 @@ describe('User API', function() {
// post '/user/reset-password'
- it('should not accept `/user/reset-password` request when password is null', function(done: $TSFixMe) {
+ it('should not accept `/user/reset-password` request when password is null', function (done: $TSFixMe) {
request
.post('/user/reset-password')
.send({
password: null,
token: 'randomToken',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should accept `/user/reset-password` request when password and token is valid', function(done: $TSFixMe) {
+ it('should accept `/user/reset-password` request when password and token is valid', function (done: $TSFixMe) {
request
.post('/user/forgot-password')
.send({
email: data.newUser.email,
})
- .end(function() {
- UserModel.findOne({ email: data.newUser.email }, function(
+ .end(function () {
+ UserModel.findOne({ email: data.newUser.email }, function (
err: $TSFixMe,
user: $TSFixMe
) {
@@ -329,7 +329,7 @@ describe('User API', function() {
password: 'newPassword',
token: user.resetPasswordToken,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
@@ -337,38 +337,38 @@ describe('User API', function() {
});
});
- it('should not accept `/isInvited` request when email is null', function(done: $TSFixMe) {
+ it('should not accept `/isInvited` request when email is null', function (done: $TSFixMe) {
request
.post('/user/isInvited')
.send({
email: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should return a boolean response for the `/isInvited` request', function(done: $TSFixMe) {
+ it('should return a boolean response for the `/isInvited` request', function (done: $TSFixMe) {
request
.post('/user/isInvited')
.send({
email: data.user.email,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.a('boolean');
done();
});
});
- it('should update the profile settings of an authenticated user', function(done: $TSFixMe) {
+ it('should update the profile settings of an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put('/user/profile')
.set('Authorization', authorization)
.send(profile)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('_id');
@@ -378,7 +378,7 @@ describe('User API', function() {
});
});
- it('should not change a password when the `currentPassword` field is not valid', function(done: $TSFixMe) {
+ it('should not change a password when the `currentPassword` field is not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put('/user/changePassword')
@@ -388,13 +388,13 @@ describe('User API', function() {
newPassword: 'abcdefghi',
confirmPassword: 'abcdefghi',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not change a password when the `newPassword` field is not valid', function(done: $TSFixMe) {
+ it('should not change a password when the `newPassword` field is not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put('/user/changePassword')
@@ -404,13 +404,13 @@ describe('User API', function() {
newPassword: null,
confirmPassword: 'abcdefghi',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not change a password when the `confirmPassword` field is not valid', function(done: $TSFixMe) {
+ it('should not change a password when the `confirmPassword` field is not valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put('/user/changePassword')
@@ -420,13 +420,13 @@ describe('User API', function() {
newPassword: 'abcdefghi',
confirmPassword: null,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should change a password when all fields are valid', function(done: $TSFixMe) {
+ it('should change a password when all fields are valid', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put('/user/changePassword')
@@ -436,19 +436,19 @@ describe('User API', function() {
newPassword: 'abcdefghi',
confirmPassword: 'abcdefghi',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.id).to.be.equal(userId);
done();
});
});
- it('should get the profile of an authenticated user', function(done: $TSFixMe) {
+ it('should get the profile of an authenticated user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get('/user/profile')
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('name');
@@ -458,13 +458,13 @@ describe('User API', function() {
});
});
- it('should not update the unverified alert phone number through profile update API', function(done: $TSFixMe) {
+ it('should not update the unverified alert phone number through profile update API', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.put('/user/profile')
.set('Authorization', authorization)
.send(profile)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res.body._id).to.be.equal(userId);
expect(res.body.alertPhoneNumber).not.to.be.equal(
profile.alertPhoneNumber
@@ -474,35 +474,35 @@ describe('User API', function() {
});
});
- it('should not delete account that belongs to another user', function(done: $TSFixMe) {
+ it('should not delete account that belongs to another user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const anotherUserId = '5ef84e17504ba0deaac459d9';
request
.delete(`/user/${anotherUserId}/delete`)
.set('Authorization', authorization)
- .end(function(_err: $TSFixMe, res: $TSFixMe) {
+ .end(function (_err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should not delete account without confirmation from the user', function(done: $TSFixMe) {
+ it('should not delete account without confirmation from the user', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/user/${userId}/delete`)
.set('Authorization', authorization)
- .end(function(_err: $TSFixMe, res: $TSFixMe) {
+ .end(function (_err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should generate backup codes when the user tries to generate a QR code.', function(done: $TSFixMe) {
+ it('should generate backup codes when the user tries to generate a QR code.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/user/totp/token/${userId}`)
.set('Authorization', authorization)
- .end(async function(_err: $TSFixMe, res: $TSFixMe) {
+ .end(async function (_err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
const user = await UserService.findOneBy({
query: { _id: userId },
@@ -515,7 +515,7 @@ describe('User API', function() {
});
});
- it('should generate new backup codes.', async function() {
+ it('should generate new backup codes.', async function () {
const authorization = `Basic ${token}`;
const user = await UserService.updateOneBy(
{ _id: userId },
@@ -534,53 +534,53 @@ describe('User API', function() {
expect(res.body[7].counter).to.eql(15);
});
- it('should delete user account and cancel all subscriptions', function(done: $TSFixMe) {
+ it('should delete user account and cancel all subscriptions', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/user/${userId}/delete`)
.set('Authorization', authorization)
.send(deleteAccountConfirmation)
- .end(function(_err: $TSFixMe, res: $TSFixMe) {
+ .end(function (_err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.user.deleted).to.equal(true);
done();
});
});
- it('should not delete account twice', function(done: $TSFixMe) {
+ it('should not delete account twice', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/user/${userId}/delete`)
.set('Authorization', authorization)
.send(deleteAccountConfirmation)
- .end(function(_err: $TSFixMe, res: $TSFixMe) {
+ .end(function (_err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('Should delete user account and remove user from the project', function(done: $TSFixMe) {
- createUser(request, data.anotherUser, function(
+ it('Should delete user account and remove user from the project', function (done: $TSFixMe) {
+ createUser(request, data.anotherUser, function (
_err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
const { id: userId } = res.body;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
_err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: data.anotherUser.email,
password: data.anotherUser.password,
})
- .end(function(_err: $TSFixMe, res: $TSFixMe) {
+ .end(function (_err: $TSFixMe, req: Response) {
const accessToken =
res.body.tokens.jwtAccessToken;
const authorization = `Basic ${accessToken}`;
@@ -591,9 +591,9 @@ describe('User API', function() {
emails: data.newUser.email,
role: 'Member',
})
- .end(function(
+ .end(function (
_err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(
res.body[0].team.length
@@ -602,9 +602,9 @@ describe('User API', function() {
.delete(`/user/${userId}/delete`)
.set('Authorization', authorization)
.send(deleteAccountConfirmation)
- .end(function(
+ .end(function (
_err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
expect(res).to.have.status(200);
expect(
@@ -622,7 +622,7 @@ describe('User API', function() {
let ssoId: $TSFixMe;
-describe('SSO authentication', function() {
+describe('SSO authentication', function () {
this.timeout(20000);
before(async () => {
@@ -649,41 +649,41 @@ describe('SSO authentication', function() {
// GET /user/sso/login
- it('Should not accept requests without email as query.', function(done: $TSFixMe) {
+ it('Should not accept requests without email as query.', function (done: $TSFixMe) {
request
.get('/user/sso/login')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('Should not accept requests with invalid email.', function(done: $TSFixMe) {
+ it('Should not accept requests with invalid email.', function (done: $TSFixMe) {
request
.get('/user/sso/login?email=invalid@email')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it("Should not accept requests with domains that aren't defined in the ssos collection.", function(done: $TSFixMe) {
+ it("Should not accept requests with domains that aren't defined in the ssos collection.", function (done: $TSFixMe) {
request
.get('/user/sso/login?email=user@inexistant-domain.hackerbay.io')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(404);
done();
});
});
- it('Should not accept requests with domains having SSO disabled', function(done: $TSFixMe) {
+ it('Should not accept requests with domains having SSO disabled', function (done: $TSFixMe) {
SsoModel.updateOne(
{ _id: ssoId },
{ $set: { 'saml-enabled': false } }
).then(() => {
request
.get('/user/sso/login?email=user@tests.hackerbay.io')
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
SsoModel.updateOne(
{ _id: ssoId },
@@ -695,7 +695,7 @@ describe('SSO authentication', function() {
});
});
- it('Should create a new user and return the login details if the user login successfully', async function() {
+ it('Should create a new user and return the login details if the user login successfully', async function () {
let userCount = await UserModel.find({
email: 'user1@tests.hackerbay.io',
}).countDocuments();
@@ -746,7 +746,7 @@ describe('SSO authentication', function() {
expect(userCount).to.eql(1);
});
- it('Should return the login details if the user exists in the database and login successfully.', async function() {
+ it('Should return the login details if the user exists in the database and login successfully.', async function () {
UserService.create({ email: 'user2@tests.hackerbay.io', sso: ssoId });
const loginRequest = await request.get(
diff --git a/backend/test/version.test.ts b/backend/test/version.test.ts
index ed86393ecf..90f1d44bab 100644
--- a/backend/test/version.test.ts
+++ b/backend/test/version.test.ts
@@ -7,11 +7,11 @@ import app from '../server';
const request = chai.request.agent(app);
-describe('Version API', function() {
+describe('Version API', function () {
this.timeout(20000);
- it('should get the current server version', function(done: $TSFixMe) {
- request.get('/version').end(function(err: $TSFixMe, res: $TSFixMe) {
+ it('should get the current server version', function (done: $TSFixMe) {
+ request.get('/version').end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body.server).to.be.equal(
process.env.npm_package_version
diff --git a/backend/test/webhook.test.ts b/backend/test/webhook.test.ts
index 40a1925b94..e5ea0db44a 100644
--- a/backend/test/webhook.test.ts
+++ b/backend/test/webhook.test.ts
@@ -18,7 +18,7 @@ import VerificationTokenModel from '../backend/models/verificationToken';
import GlobalConfig from './utils/globalConfig';
// eslint-disable-next-line
-let token: $TSFixMe, userId, projectId: $TSFixMe, monitorId: $TSFixMe, msTeamsId: $TSFixMe,msTeamsId1: $TSFixMe,slackId: $TSFixMe,slackId1: $TSFixMe;
+let token: $TSFixMe, userId, projectId: $TSFixMe, monitorId: $TSFixMe, msTeamsId: $TSFixMe, msTeamsId1: $TSFixMe, slackId: $TSFixMe, slackId1: $TSFixMe;
const monitor = {
name: 'New Monitor',
type: 'url',
@@ -43,15 +43,15 @@ const slackPayload = {
type: 'slack',
};
-describe('Webhook API', function() {
+describe('Webhook API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, async function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, async function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
projectId = res.body.project._id;
userId = res.body.id;
@@ -62,30 +62,30 @@ describe('Webhook API', function() {
{ role: 'master-admin' }
);
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
.set('Authorization', authorization)
.send(monitor)
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
msTeamsPayload.monitorId = monitorId;
@@ -101,7 +101,7 @@ describe('Webhook API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await ProjectService.hardDeleteBy({ _id: projectId });
await UserService.hardDeleteBy({
@@ -122,16 +122,16 @@ describe('Webhook API', function() {
//MS Teams
- it('should prevent unauthenticated users from creating webhooks.', function(done: $TSFixMe) {
+ it('should prevent unauthenticated users from creating webhooks.', function (done: $TSFixMe) {
request
.post(`/webhook/${projectId}/create`)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(401);
done();
});
});
- it('should reject requests missing the endpoint.', function(done: $TSFixMe) {
+ it('should reject requests missing the endpoint.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...msTeamsPayload };
@@ -140,13 +140,13 @@ describe('Webhook API', function() {
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should reject requests missing the monitorId.', function(done: $TSFixMe) {
+ it('should reject requests missing the monitorId.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...msTeamsPayload };
@@ -155,13 +155,13 @@ describe('Webhook API', function() {
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should reject requests missing the integration type.', function(done: $TSFixMe) {
+ it('should reject requests missing the integration type.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...msTeamsPayload };
@@ -170,19 +170,19 @@ describe('Webhook API', function() {
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create msteams webhook.', function(done: $TSFixMe) {
+ it('should create msteams webhook.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(msTeamsPayload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -194,19 +194,19 @@ describe('Webhook API', function() {
});
});
- it('should not create msteams webhook, with the same integration type and endpoint, for the same monitorId.', function(done: $TSFixMe) {
+ it('should not create msteams webhook, with the same integration type and endpoint, for the same monitorId.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(msTeamsPayload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create msteams webhook with a different endpoint.', function(done: $TSFixMe) {
+ it('should create msteams webhook with a different endpoint.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...msTeamsPayload };
payload.endpoint = 'http://test1.hackerbay.io';
@@ -214,7 +214,7 @@ describe('Webhook API', function() {
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -226,7 +226,7 @@ describe('Webhook API', function() {
});
});
- it('should update the msteams webhook.', function(done: $TSFixMe) {
+ it('should update the msteams webhook.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...msTeamsPayload };
payload.endpoint = 'http://newlink.hackerbay.io';
@@ -234,7 +234,7 @@ describe('Webhook API', function() {
.put(`/webhook/${projectId}/${msTeamsId}`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -245,12 +245,12 @@ describe('Webhook API', function() {
});
});
- it('should return the list of msteams webhook.', function(done: $TSFixMe) {
+ it('should return the list of msteams webhook.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/webhook/${projectId}/hooks?type=msteams`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -260,12 +260,12 @@ describe('Webhook API', function() {
});
});
- it('should delete msteams webhooks.', function(done: $TSFixMe) {
+ it('should delete msteams webhooks.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/webhook/${projectId}/delete/${msTeamsId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -278,13 +278,13 @@ describe('Webhook API', function() {
});
//Slack
- it('should create slack webhook.', function(done: $TSFixMe) {
+ it('should create slack webhook.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(slackPayload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -296,19 +296,19 @@ describe('Webhook API', function() {
});
});
- it('should not create slack webhook, with the same integration type and endpoint, for the same monitorId.', function(done: $TSFixMe) {
+ it('should not create slack webhook, with the same integration type and endpoint, for the same monitorId.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(slackPayload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create slack webhook with a different endpoint.', function(done: $TSFixMe) {
+ it('should create slack webhook with a different endpoint.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...slackPayload };
payload.endpoint = 'http://test1.slack.hackerbay.io';
@@ -316,7 +316,7 @@ describe('Webhook API', function() {
.post(`/webhook/${projectId}/create`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -328,7 +328,7 @@ describe('Webhook API', function() {
});
});
- it('should update the slack webhook.', function(done: $TSFixMe) {
+ it('should update the slack webhook.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
const payload = { ...slackPayload };
payload.endpoint = 'http://newlink.hackerbay.io';
@@ -336,7 +336,7 @@ describe('Webhook API', function() {
.put(`/webhook/${projectId}/${slackId}`)
.set('Authorization', authorization)
.send(payload)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -347,12 +347,12 @@ describe('Webhook API', function() {
});
});
- it('should return the list of slack webhook.', function(done: $TSFixMe) {
+ it('should return the list of slack webhook.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/webhook/${projectId}/hooks?type=slack`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
@@ -362,12 +362,12 @@ describe('Webhook API', function() {
});
});
- it('should delete slack webhooks.', function(done: $TSFixMe) {
+ it('should delete slack webhooks.', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.delete(`/webhook/${projectId}/delete/${slackId}`)
.set('Authorization', authorization)
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('data');
diff --git a/backend/test/zapier.test.ts b/backend/test/zapier.test.ts
index 11a7bce658..d9c0ef2ee2 100644
--- a/backend/test/zapier.test.ts
+++ b/backend/test/zapier.test.ts
@@ -28,45 +28,45 @@ const monitor = {
data: { url: 'http://www.tests.org' },
};
-describe('Zapier API', function() {
+describe('Zapier API', function () {
this.timeout(20000);
- before(function(done: $TSFixMe) {
+ before(function (done: $TSFixMe) {
this.timeout(40000);
- GlobalConfig.initTestConfig().then(function() {
- createUser(request, userData.user, function(
+ GlobalConfig.initTestConfig().then(function () {
+ createUser(request, userData.user, function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
const project = res.body.project;
projectId = project._id;
userId = res.body.id;
apiKey = project.apiKey;
- VerificationTokenModel.findOne({ userId }, function(
+ VerificationTokenModel.findOne({ userId }, function (
err: $TSFixMe,
verificationToken: $TSFixMe
) {
request
.get(`/user/confirmation/${verificationToken.token}`)
.redirects(0)
- .end(function() {
+ .end(function () {
request
.post('/user/login')
.send({
email: userData.user.email,
password: userData.user.password,
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
token = res.body.tokens.jwtAccessToken;
const authorization = `Basic ${token}`;
request
.post(`/monitor/${projectId}`)
.set('Authorization', authorization)
.send(monitor)
- .end(function(
+ .end(function (
err: $TSFixMe,
- res: $TSFixMe
+ req: Response
) {
monitorId = res.body._id;
incidentData.monitors = [monitorId];
@@ -80,7 +80,7 @@ describe('Zapier API', function() {
authorization
)
.send(incidentData)
- .end(function() {
+ .end(function () {
request
.post(
`/incident/${projectId}/create-incident`
@@ -90,7 +90,7 @@ describe('Zapier API', function() {
authorization
)
.send(incidentData)
- .end(function() {
+ .end(function () {
done();
});
});
@@ -102,7 +102,7 @@ describe('Zapier API', function() {
});
});
- after(async function() {
+ after(async function () {
await GlobalConfig.removeTestConfig();
await UserService.hardDeleteBy({
email: {
@@ -121,19 +121,19 @@ describe('Zapier API', function() {
app.close();
});
- it('should not subscribe to zapier when missing apiKey in query', function(done: $TSFixMe) {
+ it('should not subscribe to zapier when missing apiKey in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/zapier/subscribe?apiKey=${apiKey}&&projectId=${projectId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not subscribe to zapier when missing url as a parameter', function(done: $TSFixMe) {
+ it('should not subscribe to zapier when missing url as a parameter', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/zapier/subscribe?apiKey=${apiKey}&&projectId=${projectId}`)
@@ -141,13 +141,13 @@ describe('Zapier API', function() {
.send({
type: 'created',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should not subscribe to zapier when missing type as a parameter', function(done: $TSFixMe) {
+ it('should not subscribe to zapier when missing type as a parameter', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/zapier/subscribe?apiKey=${apiKey}&&projectId=${projectId}`)
@@ -155,13 +155,13 @@ describe('Zapier API', function() {
.send({
url: 'https://www.oneuptime.com',
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should subscribe to zapier service', function(done: $TSFixMe) {
+ it('should subscribe to zapier service', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/zapier/subscribe?apiKey=${apiKey}&&projectId=${projectId}`)
@@ -171,32 +171,32 @@ describe('Zapier API', function() {
type: 'created',
input: { monitors: ['12345'] },
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
zapierId = res.body.id;
expect(res).to.have.status(200);
done();
});
});
- it('should fail getting test and apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail getting test and apiKey is missing in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/test?projectId=${projectId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail when getting test and projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail when getting test and projectId is missing in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/test?apiKey=${apiKey}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
@@ -214,63 +214,63 @@ describe('Zapier API', function() {
});
*/
- it('should fail getting incidents and apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail getting incidents and apiKey is missing in query', function (done: $TSFixMe) {
request
.get(`/zapier/incidents?projectId=${projectId}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail when getting incidents and projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail when getting incidents and projectId is missing in query', function (done: $TSFixMe) {
request
.get(`/zapier/incidents?apiKey=${apiKey}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should get zapier incidents', function(done: $TSFixMe) {
+ it('should get zapier incidents', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/incidents?apiKey=${apiKey}&&projectId=${projectId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should fail getting resolved and apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail getting resolved and apiKey is missing in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/incident/resolved?projectId=${projectId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail when getting resolved and projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail when getting resolved and projectId is missing in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/incident/resolved?apiKey=${apiKey}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should get zapier resolved', function(done: $TSFixMe) {
+ it('should get zapier resolved', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(
@@ -278,37 +278,37 @@ describe('Zapier API', function() {
)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should fail getting acknowledged and apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail getting acknowledged and apiKey is missing in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/incident/acknowledged?projectId=${projectId}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail when getting acknowledged and projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail when getting acknowledged and projectId is missing in query', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(`/zapier/incident/acknowledged?apiKey=${apiKey}`)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should get zapier acknowledged', function(done: $TSFixMe) {
+ it('should get zapier acknowledged', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.get(
@@ -316,49 +316,49 @@ describe('Zapier API', function() {
)
.set('Authorization', authorization)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should unsubscribe to zapier', function(done: $TSFixMe) {
+ it('should unsubscribe to zapier', function (done: $TSFixMe) {
request
.delete(
`/zapier/unsubscribe/${zapierId}?apiKey=${apiKey}&&projectId=${projectId}`
)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
done();
});
});
- it('should fail to create incidents when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to create incidents when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/createIncident?projectId=${projectId}`)
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to create incidents when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to create incidents when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/createIncident?apiKey=${apiKey}`)
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should create incident', function(done: $TSFixMe) {
+ it('should create incident', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/createIncident?apiKey=${apiKey}&projectId=${projectId}`
@@ -366,7 +366,7 @@ describe('Zapier API', function() {
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('incidents');
@@ -376,27 +376,27 @@ describe('Zapier API', function() {
});
});
- it('should fail to acknowledge an incident when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to acknowledge an incident when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/acknowledgeIncident?projectId=${projectId}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to acknowledge an incident when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to acknowledge an incident when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/acknowledgeIncident?apiKey=${apiKey}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should acknowledge an incident', function(done: $TSFixMe) {
+ it('should acknowledge an incident', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/acknowledgeIncident?apiKey=${apiKey}&projectId=${projectId}`
@@ -404,7 +404,7 @@ describe('Zapier API', function() {
.send({
incidents: [incidentId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.be.an('object');
expect(res.body).to.have.property('incidents');
@@ -414,27 +414,27 @@ describe('Zapier API', function() {
});
});
- it('should fail to resolve an incident when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to resolve an incident when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/resolveIncident?projectId=${projectId}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to resolve an incident when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to resolve an incident when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/resolveIncident?apiKey=${apiKey}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should resolve an incident', function(done: $TSFixMe) {
+ it('should resolve an incident', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/resolveIncident?apiKey=${apiKey}&projectId=${projectId}`
@@ -442,7 +442,7 @@ describe('Zapier API', function() {
.send({
incidents: [incidentId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.be.an('object');
expect(res.body).to.have.property('incidents');
@@ -452,7 +452,7 @@ describe('Zapier API', function() {
});
});
- it('should fail to acknowledge last incidents when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to acknowledge last incidents when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/acknowledgeLastIncident?projectId=${projectId}`
@@ -460,25 +460,25 @@ describe('Zapier API', function() {
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to acknowledge last incidents when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to acknowledge last incidents when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/acknowledgeLastIncident?apiKey=${apiKey}`)
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should acknowledge last incident', function(done: $TSFixMe) {
+ it('should acknowledge last incident', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/acknowledgeLastIncident?apiKey=${apiKey}&projectId=${projectId}`
@@ -486,7 +486,7 @@ describe('Zapier API', function() {
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('incidents');
@@ -496,31 +496,31 @@ describe('Zapier API', function() {
});
});
- it('should fail to resolve last incidents when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to resolve last incidents when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/resolveLastIncident?projectId=${projectId}`)
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to resolve last incidents when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to resolve last incidents when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/resolveLastIncident?apiKey=${apiKey}`)
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should resolve last incident', function(done: $TSFixMe) {
+ it('should resolve last incident', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/resolveLastIncident?apiKey=${apiKey}&projectId=${projectId}`
@@ -528,7 +528,7 @@ describe('Zapier API', function() {
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('incidents');
@@ -538,40 +538,40 @@ describe('Zapier API', function() {
});
});
- it('should fail to acknowledge all incidents when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to acknowledge all incidents when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/acknowledgeAllIncidents?projectId=${projectId}`
)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to acknowledge all incidents when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to acknowledge all incidents when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/acknowledgeAllIncidents?apiKey=${apiKey}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should acknowledge all incident', function(done: $TSFixMe) {
+ it('should acknowledge all incident', function (done: $TSFixMe) {
const authorization = `Basic ${token}`;
request
.post(`/incident/${projectId}/create-incident`)
.set('Authorization', authorization)
.send(incidentData)
- .end(function() {
+ .end(function () {
request
.post(`/incident/${projectId}/create-incident`)
.set('Authorization', authorization)
.send(incidentData)
- .end(function() {
+ .end(function () {
request
.post(
`/zapier/incident/acknowledgeAllIncidents?apiKey=${apiKey}&projectId=${projectId}`
@@ -579,7 +579,7 @@ describe('Zapier API', function() {
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('incidents');
@@ -595,27 +595,27 @@ describe('Zapier API', function() {
});
});
- it('should fail to resolve all incidents when apiKey is missing in query', function(done: $TSFixMe) {
+ it('should fail to resolve all incidents when apiKey is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/resolveAllIncidents?projectId=${projectId}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should fail to resolve all incidents when projectId is missing in query', function(done: $TSFixMe) {
+ it('should fail to resolve all incidents when projectId is missing in query', function (done: $TSFixMe) {
request
.post(`/zapier/incident/resolveAllIncidents?apiKey=${apiKey}`)
.send()
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(400);
done();
});
});
- it('should resolve all incident', function(done: $TSFixMe) {
+ it('should resolve all incident', function (done: $TSFixMe) {
request
.post(
`/zapier/incident/resolveAllIncidents?apiKey=${apiKey}&projectId=${projectId}`
@@ -623,7 +623,7 @@ describe('Zapier API', function() {
.send({
monitors: [monitorId],
})
- .end(function(err: $TSFixMe, res: $TSFixMe) {
+ .end(function (err: $TSFixMe, req: Response) {
expect(res).to.have.status(200);
expect(res.body).to.be.an('object');
expect(res.body).to.have.property('incidents');
diff --git a/common-server/utils/response.ts b/common-server/utils/response.ts
index 96a7b0d0d2..59de9a0684 100644
--- a/common-server/utils/response.ts
+++ b/common-server/utils/response.ts
@@ -2,20 +2,20 @@ import JsonToCsv from './jsonToCsv';
import ErrorService from './error';
import logger from './logger';
import { GridFSBucket } from 'mongodb';
+import { Request, Response } from './express';
+
function logResponse(req: Request, res: Response, responsebody: $TSFixMe) {
const requestEndedAt = Date.now();
const method = req.method;
const url = req.url;
- const duration_info = `OUTGOING RESPONSE ID: ${req.id} -- POD NAME: ${
- process.env.POD_NAME
- } -- METHOD: ${method} -- URL: ${url} -- DURATION: ${requestEndedAt -
+ const duration_info = `OUTGOING RESPONSE ID: ${req.id} -- POD NAME: ${process.env.POD_NAME
+ } -- METHOD: ${method} -- URL: ${url} -- DURATION: ${requestEndedAt -
req.requestStartedAt}ms -- STATUS: ${res.statusCode}`;
- const body_info = `OUTGOING RESPONSE ID: ${req.id} -- RESPONSE BODY: ${
- responsebody ? JSON.stringify(responsebody, null, 2) : 'EMPTY'
- }`;
+ const body_info = `OUTGOING RESPONSE ID: ${req.id} -- RESPONSE BODY: ${responsebody ? JSON.stringify(responsebody, null, 2) : 'EMPTY'
+ }`;
if (res.statusCode > 299) {
logger.error(duration_info);
diff --git a/dashboard/index.ts b/dashboard/index.ts
index 9e629fad76..7b3504e5db 100755
--- a/dashboard/index.ts
+++ b/dashboard/index.ts
@@ -25,7 +25,7 @@ import cors from 'cors';
app.use(cors());
-app.use(function(req: Request, res: Response, next: $TSFixMe) {
+app.use(function (req: Request, res: Response, next: $TSFixMe) {
if (typeof req.body === 'string') {
req.body = JSON.parse(req.body);
}
@@ -42,9 +42,9 @@ app.use(function(req: Request, res: Response, next: $TSFixMe) {
return next();
});
-app.get(['/env.js', '/dashboard/env.js'], function(
- req: $TSFixMe,
- res: $TSFixMe
+app.get(['/env.js', '/dashboard/env.js'], function (
+ req: Request,
+ req: Response
) {
const isClustLocal = req.get('host').includes('cluster.local');
if (!isClustLocal) {
@@ -106,17 +106,17 @@ app.get(['/env.js', '/dashboard/env.js'], function(
});
//APP VERSION
-app.use(['/dashboard/api/version', '/dashboard/version'], function(
- req: $TSFixMe,
- res: $TSFixMe
+app.use(['/dashboard/api/version', '/dashboard/version'], function (
+ req: Request,
+ req: Response
) {
res.setHeader('Content-Type', 'application/json');
res.json({ dashboardVersion: process.env.npm_package_version });
});
-app.get(['/dashboard/status', '/status'], function(
- req: $TSFixMe,
- res: $TSFixMe
+app.get(['/dashboard/status', '/status'], function (
+ req: Request,
+ req: Response
) {
res.setHeader('Content-Type', 'application/json');
res.send(
@@ -168,7 +168,7 @@ app.use('/dashboard', express.static(path.join(__dirname, 'build')));
// }
// });
-app.get('/*', function(req: Request, res: Response) {
+app.get('/*', function (req: Request, res: Response) {
res.sendFile(path.join(__dirname, 'build', 'index.html'));
});
diff --git a/dashboard/src/components/modals/AddExternalStatusPagesModal.tsx b/dashboard/src/components/modals/AddExternalStatusPagesModal.tsx
index 2ce623e486..b8806f0c06 100644
--- a/dashboard/src/components/modals/AddExternalStatusPagesModal.tsx
+++ b/dashboard/src/components/modals/AddExternalStatusPagesModal.tsx
@@ -32,7 +32,7 @@ class AddExternalStatusPagesModal extends Component {
statusPage.status._id,
values
)
- .then((res: $TSFixMe) => {
+ .then((req: Response) => {
if (res) {
this.handleCloseModal();
}
diff --git a/dashboard/src/components/modals/CreateAnnouncement.tsx b/dashboard/src/components/modals/CreateAnnouncement.tsx
index 864997e850..8bb75d0465 100644
--- a/dashboard/src/components/modals/CreateAnnouncement.tsx
+++ b/dashboard/src/components/modals/CreateAnnouncement.tsx
@@ -119,7 +119,7 @@ class CreateAnnouncement extends Component {
}
createAnnouncement(projectId, statusPage._id, { data: postObj })
- .then((res: $TSFixMe) => {
+ .then((req: Response) => {
if (res) {
this.handleCloseModal();
fetchAnnouncements(projectId, statusPage._id, 0, 10);
@@ -283,13 +283,13 @@ class CreateAnnouncement extends Component {
: 'No Monitor available',
},
...(mergeMonitors &&
- mergeMonitors.length > 0
+ mergeMonitors.length > 0
? mergeMonitors.map(
- (monitor: $TSFixMe) => ({
- value: monitor._id,
- label: `${monitor.componentId.name} / ${monitor.name}`
- })
- )
+ (monitor: $TSFixMe) => ({
+ value: monitor._id,
+ label: `${monitor.componentId.name} / ${monitor.name}`
+ })
+ )
: []),
]}
/>
diff --git a/dashboard/src/components/modals/EditAnnouncement.tsx b/dashboard/src/components/modals/EditAnnouncement.tsx
index 183fc8294b..b2c28faffa 100644
--- a/dashboard/src/components/modals/EditAnnouncement.tsx
+++ b/dashboard/src/components/modals/EditAnnouncement.tsx
@@ -100,7 +100,7 @@ class EditAnnouncement extends Component {
updateAnnouncement(projectId, statusPage._id, announcement._id, {
data: postObj,
})
- .then((res: $TSFixMe) => {
+ .then((req: Response) => {
if (res) {
this.handleCloseModal();
fetchAnnouncements(projectId, statusPage._id, 0, 10);
@@ -264,13 +264,13 @@ class EditAnnouncement extends Component {
: 'No Monitor available',
},
...(mergeMonitors &&
- mergeMonitors.length > 0
+ mergeMonitors.length > 0
? mergeMonitors.map(
- (monitor: $TSFixMe) => ({
- value: monitor._id,
- label: `${monitor.componentId.name} / ${monitor.name}`
- })
- )
+ (monitor: $TSFixMe) => ({
+ value: monitor._id,
+ label: `${monitor.componentId.name} / ${monitor.name}`
+ })
+ )
: []),
]}
/>
diff --git a/dashboard/src/components/modals/EditExternalStatusPageModal.tsx b/dashboard/src/components/modals/EditExternalStatusPageModal.tsx
index d1bae45588..b91c4d046a 100644
--- a/dashboard/src/components/modals/EditExternalStatusPageModal.tsx
+++ b/dashboard/src/components/modals/EditExternalStatusPageModal.tsx
@@ -32,7 +32,7 @@ class EditExternalStatusPagesModal extends Component {
data.link._id,
values
)
- .then((res: $TSFixMe) => {
+ .then((req: Response) => {
if (res) {
this.handleCloseModal();
}
diff --git a/dashboard/src/components/modals/HideAnnouncement.tsx b/dashboard/src/components/modals/HideAnnouncement.tsx
index 29f8e106a7..b6ce8fad4b 100644
--- a/dashboard/src/components/modals/HideAnnouncement.tsx
+++ b/dashboard/src/components/modals/HideAnnouncement.tsx
@@ -65,7 +65,7 @@ class HideAnnouncement extends Component {
announcement._id,
{ data }
)
- .then((res: $TSFixMe) => {
+ .then((req: Response) => {
if (res) {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'closeThisDialog' does not exist on type ... Remove this comment to see the full error message
this.props.closeThisDialog();
diff --git a/dashboard/src/components/nav/SideNav.tsx b/dashboard/src/components/nav/SideNav.tsx
index 29dfd24657..1870297a69 100755
--- a/dashboard/src/components/nav/SideNav.tsx
+++ b/dashboard/src/components/nav/SideNav.tsx
@@ -51,7 +51,7 @@ class SideNav extends Component {
this.props
// @ts-expect-error ts-migrate(2339) FIXME: Property 'getSubProjects' does not exist on type '... Remove this comment to see the full error message
.getSubProjects(this.props.currentProject._id)
- .then((res: $TSFixMe) => {
+ .then((req: Response) => {
// @ts-expect-error ts-migrate(2339) FIXME: Property 'switchToProjectViewer' does not exist on... Remove this comment to see the full error message
this.props.switchToProjectViewer(
User.getUserId(),
@@ -143,10 +143,10 @@ class SideNav extends Component {
const IMG_URL =
// @ts-expect-error ts-migrate(2339) FIXME: Property 'profilePic' does not exist on type 'Read... Remove this comment to see the full error message
this.props.profilePic &&
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'profilePic' does not exist on type 'Read... Remove this comment to see the full error message
- this.props.profilePic !== '' &&
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'profilePic' does not exist on type 'Read... Remove this comment to see the full error message
- this.props.profilePic !== 'null'
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'profilePic' does not exist on type 'Read... Remove this comment to see the full error message
+ this.props.profilePic !== '' &&
+ // @ts-expect-error ts-migrate(2339) FIXME: Property 'profilePic' does not exist on type 'Read... Remove this comment to see the full error message
+ this.props.profilePic !== 'null'
// @ts-expect-error ts-migrate(2339) FIXME: Property 'profilePic' does not exist on type 'Read... Remove this comment to see the full error message
? `url(${API_URL}/file/${this.props.profilePic})`
: 'url(https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mp&f=y)';
@@ -311,7 +311,7 @@ class SideNav extends Component {
className={`db-World-sideNavContainer${
// @ts-expect-error ts-migrate(2339) FIXME: Property 'sidenavopen' does not exist on type 'Rea... Remove this comment to see the full error message
this.props.sidenavopen ? ' open' : ''
- }`}
+ }`}
>