Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7795067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:57:31+00:00 2026-06-01T22:57:31+00:00

I have a Backbone Collection and I need to pass some parameters to the

  • 0

I have a Backbone Collection and I need to pass some parameters to the .fetch({data : {gender : ‘male’}}). Is there a way to test with jasmine that the parameters are passed?

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:57:33+00:00Added an answer on June 1, 2026 at 10:57 pm

    You could probably achieve that by using the method in the example below.
    Please note that, the below code will intercept the fetch-call and return, the call will not reach the server. If you would like to have the server-side emulation, then you would need to use Sinon or some other such similar methods.

        describe("People collection" function() {
            var people = Backbone.Collection.extend({
                // ...
            });
    
            function searchPeople(people, data ) {
                people.fetch(data);
            }
    
            it("must verify the fetch parameters!", function(){
                var param = {data : {gender : 'male'}};
                // Set up the spy.
                spyOn(people, 'fetch').andReturn(); // Warning: this makes the call synchronous, Fetch actually won't go through!
    
                // Now perform the operation that would invoke Collection.fetch.
                searchPeople(people, param);
    
                expect(people.fetch).toHaveBeenCalled();            // Verifies the fetch was actually called.
                expect(people.fetch).toHaveBeenCalledWith(param);   // Verifies that the fetch was called with specified param.
    
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Backbone.js collection that holds (for example) 30 items. I want to pass
My Backbone Collection receives 30 models on fetch(). I have tried newColl=origColl.first(2); to return
I have a backbone.js collection with male and female models. In my interface I
I have a collection of flash cards that are tied to a Backbone collection.
I have a Backbone View that has a Collection as its Model. If the
I use Backbone.js and jQuery 1.7 in my application and I have some problems
As in the backbone-todolist example,I have a collection of elements. I made 2 views,
I am writing a Backbone application, and I need to offer some feedback to
I have the following Backbone.js model and collection: // Model lr.Event = Backbone.Model.extend({}); //
I have very simple backbone model and collection. I have a corresponding backbone.marionette.CollectionView and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.