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

return removed fixtures when adding new fixtures #154

Merged
merged 9 commits into from
Feb 1, 2019
Merged

Conversation

randallwhitlock
Copy link

@randallwhitlock randallwhitlock commented Aug 13, 2018

#34 Changed fixture to return removed fixture settings.

  • Needs docs

@justinbmeyer
Copy link
Contributor

WOW! I just noticed this. Thank you so much!

core.js Outdated
}

// Adds a fixture to the list of fixtures.
exports.add = function (settings, fixture) {

if (Array.isArray(settings)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

When does this case get called?

xhr.open('GET', 'services/thing');
xhr.send({});

// fixture("services/thing", function(){ ... CODE B ... });
Copy link
Contributor

Choose a reason for hiding this comment

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

cruft needing to be cleaned up?

@justinbmeyer
Copy link
Contributor

@randallwhitlock, @cherifGsoul is going to work on this Monday. Those comments were for him. Thanks again for submitting!

@cherifGsoul
Copy link
Member

@justinbmeyer I cleaned up the code, can you please review?

@cherifGsoul
Copy link
Member

The context

  • Users need to be able to define fixtures, remove and restore them.

Expected behavior:

  • Removing fixtures should return old fixtures for futur reuse

The changes I made after @randallwhitlock commit :

  • Clean up the tests
  • Improve how to handle ajaxSettings as Array instead of plain object by using the code that already exists and just make sure we pass the right ajaxSettings and url data types we pass tofixture function.

cc @justinbmeyer

@cherifGsoul
Copy link
Member

@randallwhitlock Thank you for this, we still working on it.

@cherifGsoul cherifGsoul reopened this Dec 22, 2018
start();
});
xhr.open('GET', '/services/thing');
xhr.send();
Copy link
Member

Choose a reason for hiding this comment

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

Is the XHR needed? If so, I don’t understand what’s going on here and we should add some more comments to make it clear.

Copy link
Member

Choose a reason for hiding this comment

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

@chasenlehara can you please explain what is not clear? I just hit the fixture under the test with XHR request.

Copy link
Member

Choose a reason for hiding this comment

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

Here’s my understanding of what’s happening in this test:

  1. Setting up a fixture
  2. Removing the fixture
  3. Defining a new fixture
  4. Testing that the old fixture was returned when it was removed
  5. Setting up the old fixture again
  6. Making an XHR that will call the old fixture

I’m not sure why steps 3, 5, and 6 happen, because only 1, 2, and 4 seem necessary for the test.

Copy link
Member

Choose a reason for hiding this comment

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

@chasenlehara Thank you, I changed it.
It was just to make sure the returned fixture really works as expected.

Copy link
Member

@chasenlehara chasenlehara left a comment

Choose a reason for hiding this comment

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

👍

@cherifGsoul cherifGsoul merged commit d4ac1f0 into master Feb 1, 2019
@cherifGsoul cherifGsoul deleted the 34-oldfixtures branch February 1, 2019 19:58
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.

5 participants