-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add unit tests and GitHub Actions step to run them #49
Conversation
Related to #35 Add unit tests and GitHub Actions workflow for `influxdb-reporter`. * **Unit Tests** - Create `test/influxdb-reporter.test.js` to test `InfluxDBReporter` class. - Test initialization, `start`, `beforeItem`, `request`, `assertion`, `item`, and `done` methods. - Mock necessary objects and functions for testing. * **GitHub Actions Workflow** - Add `.github/workflows/main.yml` to define CI workflow. - Include steps to checkout repository, set up Node.js, install dependencies, build, and run unit tests. * **package.json** - Update `scripts` section to include `"test": "jest"`. - Add `jest` as a dev dependency.
}); | ||
|
||
it('should update currentItem data for skipped assertion', function() { | ||
const args = { skipped: true, assertion: 'Test Assertion' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
|
||
describe('assertion', function() { | ||
it('should update currentItem data for failed assertion', function() { | ||
const error = { test: 'Test Assertion', name: 'AssertionError', message: 'Test failed' }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
const args = { | ||
cursor: {}, | ||
item: { name: 'Test Item' }, | ||
request: { url: { toString: () => 'http://example.com' }, method: 'GET' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').
|
||
describe('request', function() { | ||
it('should update currentItem data', function() { | ||
const args = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
let reporter; | ||
let newmanEmitter; | ||
let reporterOptions; | ||
let options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
describe('InfluxDBReporter', function() { | ||
let reporter; | ||
let newmanEmitter; | ||
let reporterOptions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
|
||
describe('InfluxDBReporter', function() { | ||
let reporter; | ||
let newmanEmitter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
const InfluxDBReporter = require('../src/influxdb-reporter'); | ||
|
||
describe('InfluxDBReporter', function() { | ||
let reporter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'let' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
@@ -0,0 +1,104 @@ | |||
const assert = require('assert'); | |||
const InfluxDBReporter = require('../src/influxdb-reporter'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
@@ -0,0 +1,104 @@ | |||
const assert = require('assert'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'const' is available in ES6 (use 'esversion: 6') or Mozilla JS extensions (use moz).
Quality Gate passedIssues Measures |
Related to #35
Add unit tests and GitHub Actions workflow for
influxdb-reporter
.Unit Tests
test/influxdb-reporter.test.js
to testInfluxDBReporter
class.start
,beforeItem
,request
,assertion
,item
, anddone
methods.GitHub Actions Workflow
.github/workflows/main.yml
to define CI workflow.package.json
scripts
section to include"test": "jest"
.jest
as a dev dependency.