diff --git a/__checks__/api.check.ts b/__checks__/api.check.ts new file mode 100644 index 0000000..d75330d --- /dev/null +++ b/__checks__/api.check.ts @@ -0,0 +1,22 @@ +import { ApiCheck, AssertionBuilder } from 'checkly/constructs' + +// API checks send an HTTP request to a URL endpoint and validate the response. Read more at: +// https://www.checklyhq.com/docs/api-checks/ + +new ApiCheck('books-api-check-1', { + name: 'Books API', + alertChannels: [], + degradedResponseTime: 10000, // milliseconds + maxResponseTime: 20000, + request: { + url: 'https://danube-web.shop/api/books', + method: 'GET', + followRedirects: true, + skipSSL: false, + assertions: [ + AssertionBuilder.statusCode().equals(200), + AssertionBuilder.jsonBody('$[0].id').isNotNull(), + ], + }, + runParallel: false, +}) diff --git a/__checks__/heartbeat.check.ts b/__checks__/heartbeat.check.ts new file mode 100644 index 0000000..8db2b49 --- /dev/null +++ b/__checks__/heartbeat.check.ts @@ -0,0 +1,16 @@ +import { HeartbeatMonitor } from 'checkly/constructs' + +// Heartbeat monitors allow you to monitor jobs or recurring tasks. +// After you deploy this check, you'll get a ping URL for your check +// from the Checkly CLI. This check will generate alerts if it's not +// getting pings at the generated URL, so it's deactivated for now. +// Further documentation: https://www.checklyhq.com/docs/heartbeat-monitors/ + +new HeartbeatMonitor('heartbeat-1', { + name: 'Send weekly newsletter job', + activated: false, + period: 1, + periodUnit: 'hours', + grace: 30, + graceUnit: 'minutes', + }) diff --git a/__checks__/homepage.spec.ts b/__checks__/homepage.spec.ts new file mode 100644 index 0000000..630d339 --- /dev/null +++ b/__checks__/homepage.spec.ts @@ -0,0 +1,12 @@ +import { test, expect } from '@playwright/test' + +// This test is being used as a Browser check +// See browserCheck.testMatch in your checkly.config.ts to configure + +test('Visit webshop homepage', async ({ page }) => { + // The baseURL for Browser checks can be set in the playwrightConfig of your checkly.config.ts + const response = await page.goto('/') + expect(response?.status()).toBeLessThan(400) + await expect(page).toHaveTitle(/Danube WebShop/) + await page.screenshot({ path: 'homepage.jpg' }) +}) diff --git a/__checks__/url.check.ts b/__checks__/url.check.ts new file mode 100644 index 0000000..9cf3851 --- /dev/null +++ b/__checks__/url.check.ts @@ -0,0 +1,15 @@ +import { UrlAssertionBuilder, UrlMonitor } from 'checkly/constructs' + +new UrlMonitor('books-url-check', { + name: 'Books URL', + activated: true, + maxResponseTime: 10000, + degradedResponseTime: 5000, + request: { + url: 'https://www.danube-web.shop/', + followRedirects: true, + assertions: [ + UrlAssertionBuilder.statusCode().equals(200), + ] + } +}) diff --git a/package.json b/package.json index a03eb29..1d20533 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,6 @@ "bugs": { "url": "https://github.com/zayed-cybershield/protection/issues" }, - "keywords": [ "cybersecurity", "cryptography", @@ -35,18 +34,15 @@ "حماية", "الإمارات" ], - "engines": { "node": ">=18.0.0", "npm": ">=9.0.0" }, - "dependencies": { "@noble/secp256k1": "^3.0.0", "express": "^4.19.0", "lodash": "^4.17.21" }, - "devDependencies": { "ajv": "^8.18.0", "ajv-keywords": "^5.1.0", @@ -58,38 +54,32 @@ "webpack": "^6.0.0", "webpack-cli": "^5.1.4", "html-webpack-plugin": "^5.6.6", - "terser-webpack-plugin": "^5.3.16" + "terser-webpack-plugin": "^5.3.16", + "checkly": "latest", + "jiti": "^2" }, - "peerDependencies": { "react": ">=18.0.0", "vue": ">=3.0.0" }, - "scripts": { "test": "jest", "test:coverage": "nyc npm test", "lint": "eslint .", "lint:fix": "eslint . --fix", - "security:check": "npm audit --omit=dev", "security:fix": "npm audit fix", "security:update": "npm update && npm audit", "security:full": "npm audit && npm outdated", - "prebuild": "npm run security:check", "build": "webpack --mode production", "dev": "webpack --mode development --watch", - "start": "node index.js", - "clean": "rm -rf node_modules package-lock.json", "reinstall": "npm run clean && npm install", - "prepare": "npm run build", "prepublishOnly": "npm test && npm run lint" }, - "files": [ "dist/", "src/", @@ -100,6 +90,5 @@ "SECURITY.md", "CHANGELOG.md" ], - "types": "index.d.ts" -} +} \ No newline at end of file