dimanche 10 décembre 2017

Unit Test Rxjs 5

I am trying to write a test using mocha and chai for my observable methods that makes a call to a server and returns some json data. However, when I run the test I get the following error: Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. Even when I overwrite the default timeout time, I still get the above error. What am I doing wrong ?

describe("some test", () => {
    let someClass: SomeClass;

    before(() => {
        someClass = new SomeClass();
    });
    ;

    it("should meet some condition", done => {

        let getData = someClass.getData('query')

        getData.subscribe(json => {
            json.success.should.equal(true);
            done();
        },
            done
        );

    });
});

Aucun commentaire:

Enregistrer un commentaire