Bug: moxios.wait doesn't call axios promise if the axios call being tested passes params into it

This issue has been tracked since 2022-09-29.

Moxios version: 0.4.0
Axios version: 0.27.2

Issue: If a params object with any parameters is passed into an axios.get call, the moxios.wait function never causes the axios promise to execute.

I made a sample project to replicate the bug here: isolated_test_bug.zip There are two tests in the project: both of the tests should pass, but instead, one of them passes and one of them fails.

Here are the tests from the attached project above:

const axios = require("axios");
const moxios = require("moxios");

describe("moxios.wait", function () {

    let counter;

    beforeEach(function () {
        moxios.install();
    });

    afterEach(function () {
        moxios.uninstall();
    });

    function axiosTest(params) {
        moxios.stubRequest("test.com", {
            code: 200,
            response: "hello world"
        });
        counter = 0;

        axios.get("test.com", {
            params: params
        }).then(function () {
            counter = 1;
        });
    }

    // This test passes. Good!
    it("should work with an empty params object", function (done) {
        
        axiosTest({});

        moxios.wait(function () {
            expect(counter).toBe(1);
            done();
        });
    });

    // This test fails, but it should pass.
    it("should work with a non-empty params object", function (done) {

        axiosTest({
            "hello": "world"
        });

        moxios.wait(function () {
            expect(counter).toBe(1);
            done();
        });
    });
});

I'm happy to share any other information that might be helpful. Thanks! :)

More Details About Repo
Owner Name axios
Repo Name moxios
Full Name axios/moxios
Language JavaScript
Created Date 2016-05-25
Updated Date 2022-12-05
Star Count 1386
Watcher Count 20
Fork Count 85
Issue Count 19

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date