SwaggerSchema.cy.js 609 B

123456789101112131415161718192021
  1. /// <reference types="cypress" />
  2. const SWAGGER_SCHEMA_FILENAME = 'results/swagger-schema.json';
  3. describe('Swagger Schema Linting', () => {
  4. it('Should be a completely valid schema', () => {
  5. // Save the schema to a file and lint it
  6. cy.request('/api/schema')
  7. .then((response) => {
  8. const fileContent = response.body;
  9. cy.writeFile(SWAGGER_SCHEMA_FILENAME, fileContent);
  10. })
  11. .then(() => {
  12. cy.exec(`yarn swagger-lint '${SWAGGER_SCHEMA_FILENAME}'`)
  13. .then((result) => {
  14. cy.log("Swagger Vacuum Results:\n", result.stdout);
  15. expect(result.code).to.eq(0);
  16. });
  17. });
  18. });
  19. });