Skip to content

Commit

Permalink
fix: add post test and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Oct 1, 2023
1 parent c875880 commit 534eb74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@
"prepublishOnly": "npm run build",
"pretest": "npm run build",
"pretest:coverage": "npm run build",
"posttest": "rimraf ./test.asyncapi-cli",
"release": "semantic-release",
"test": "npm run test:unit",
"test:unit": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 100000 \"test/**/*.test.ts\" && rimraf ./test.asyncapi-cli",
"test:unit": "cross-env NODE_ENV=development TEST=1 CUSTOM_CONTEXT_FILENAME=\"test.asyncapi-cli\" CUSTOM_CONTEXT_FILE_LOCATION=\"\" nyc --extension .ts mocha --require ts-node/register --require test/helpers/init.js --reporter spec --timeout 100000 \"test/**/*.test.ts\"",
"get-version": "echo $npm_package_version"
},
"types": "lib/index.d.ts"
Expand Down
6 changes: 3 additions & 3 deletions test/integration/validate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('validate', () => {
.stdout()
.command(['validate', './test/fixtures/valid-specification-latest.yml'])
.it('works when file path is passed', (ctx, done) => {
expect(ctx.stdout).to.match(/File .\/test\/fixtures\/valid-specification.yml is valid! File .\/test\/fixtures\/valid-specification.yml and referenced documents don't have governance issues./);
expect(ctx.stdout).to.include('File ./test/fixtures/valid-specification-latest.yml is valid! File ./test/fixtures/valid-specification-latest.yml and referenced documents don\'t have governance issues.');
expect(ctx.stderr).to.equal('');
done();
});
Expand Down Expand Up @@ -220,7 +220,7 @@ describe('validate', () => {
.stdout()
.command(['validate', './test/fixtures/valid-specification-latest.yml', '--diagnostics-format=text'])
.it('works with --diagnostics-format flag (without governance issues)', (ctx, done) => {
expect(ctx.stdout).to.match(new RegExp('File ./test/fixtures/valid-specification.yml is valid! File ./test/fixtures/valid-specification.yml and referenced documents don\'t have governance issues.'));
expect(ctx.stdout).to.include('\nFile ./test/fixtures/valid-specification-latest.yml is valid! File ./test/fixtures/valid-specification-latest.yml and referenced documents don\'t have governance issues.');
expect(ctx.stderr).to.equal('');
done();
});
Expand All @@ -240,7 +240,7 @@ describe('validate', () => {
.stdout()
.command(['validate', './test/fixtures/specification.yml', '--fail-severity=warn'])
.it('works with --fail-severity', (ctx, done) => {
expect(ctx.stderr).to.match(new RegExp('File ./test/fixtures/specification.yml and\\/or referenced documents have governance issues.\\n\\ntest\\/fixtures\\/specification.yml'));
expect(ctx.stderr).to.include('\nFile ./test/fixtures/specification.yml and/or referenced documents have governance issues.\n\ntest/fixtures/specification.yml');
done();
});
});
Expand Down

0 comments on commit 534eb74

Please sign in to comment.