Browse Source

Adds test for dashboard endpoints

Jamie Curnow 7 months ago
parent
commit
5e66d677f1
2 changed files with 26 additions and 0 deletions
  1. 1 0
      docker/docker-compose.ci.mysql.yml
  2. 25 0
      test/cypress/e2e/api/Dashboard.cy.js

+ 1 - 0
docker/docker-compose.ci.mysql.yml

@@ -18,6 +18,7 @@ services:
       MYSQL_DATABASE: 'npm'
       MYSQL_USER: 'npm'
       MYSQL_PASSWORD: 'npmpass'
+      MARIADB_AUTO_UPGRADE: '1'
     volumes:
       - mysql_vol:/var/lib/mysql
     networks:

+ 25 - 0
test/cypress/e2e/api/Dashboard.cy.js

@@ -0,0 +1,25 @@
+/// <reference types="cypress" />
+
+describe('Dashboard endpoints', () => {
+	let token;
+
+	before(() => {
+		cy.getToken().then((tok) => {
+			token = tok;
+		});
+	});
+
+	it('Should be able to get host counts', function() {
+		cy.task('backendApiGet', {
+			token: token,
+			path:  '/api/reports/hosts'
+		}).then((data) => {
+			cy.validateSwaggerSchema('get', 200, '/reports/hosts', data);
+			expect(data).to.have.property('dead');
+			expect(data).to.have.property('proxy');
+			expect(data).to.have.property('redirection');
+			expect(data).to.have.property('stream');
+		});
+	});
+
+});