Skip to content
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

Test: add recording #123

Merged
merged 9 commits into from
Jul 26, 2018
Merged

Test: add recording #123

merged 9 commits into from
Jul 26, 2018

Conversation

Khaledgarbaya
Copy link
Contributor

@Khaledgarbaya Khaledgarbaya commented Jul 19, 2018

This PR adds recording to the integration and en2en tests so users can run them on their machine without the need to hit the API endpoint

package.json Outdated
@@ -112,7 +113,8 @@
"tslint": "^5.7.0",
"tslint-config-standard": "^6.0.1",
"typescript": "^2.5.3",
"uuid": "^3.2.1"
"uuid": "^3.2.1",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure but didn't you remove all the uuid usage?

@codecov
Copy link

codecov bot commented Jul 24, 2018

Codecov Report

Merging #123 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #123   +/-   ##
=======================================
  Coverage   79.23%   79.23%           
=======================================
  Files          75       75           
  Lines        1999     1999           
  Branches      230      230           
=======================================
  Hits         1584     1584           
  Misses        323      323           
  Partials       92       92

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4a5b87e...1debacb. Read the comment docs.

@Khaledgarbaya Khaledgarbaya changed the title WIP: Test/add recording Test: add recording Jul 24, 2018
@Khaledgarbaya
Copy link
Contributor Author

@axe312ger Can you 👀

@Khaledgarbaya Khaledgarbaya requested a review from axe312ger July 24, 2018 14:16
test/record.js Outdated
module.exports = function (name, options) {
// options tell us where to store our fixtures
options = options || {};
const fixtureFolder = options.fixtureFoldr || 'fixtures';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in options config fixtureFoldr

// `hasFixture` indicates whether the test has fixtures we should read,
// or doesn't, so we should record and save them.
// the environment variable `NOCK_RECORD` can be used to force a new recording.
let hasFixture = process.env.NOCK_RECORD === 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on your comment I'd expect it to detect if a fixture is present or not. But you just hardcoded it based on the environment variable. When I look at the npm scripts, it is always 0, so hasFixture would always be false, creating new fixtures every run. How does this work? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes we want to refresh the fixtures if for example, we add a new endpoint so we change NOCK_RECORD to 1

},
// saves our recording if fixtures didn't already exist
after: function (done) {
if (!hasFixture) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt you check this based if you have a recording available or not? Plus only record when you need to? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above

before(recorder.before);
after(recorder.after);

const ENVIRONMENT_ID = 'env-integration';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 on how easy it is to integrate <3

@Khaledgarbaya Khaledgarbaya requested a review from axe312ger July 26, 2018 08:56
@Khaledgarbaya Khaledgarbaya merged commit f7973b3 into master Jul 26, 2018
@Khaledgarbaya Khaledgarbaya deleted the test/add-recording branch July 26, 2018 11:50
@axe312ger
Copy link
Collaborator

😻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants