Skip to content

Instantly share code, notes, and snippets.

@nkbt
Created February 20, 2014 00:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save nkbt/9104832 to your computer and use it in GitHub Desktop.
it('should return error if at least one domain is unavailable', function (done) {
nock(test.mock.user)
.intercept('/info', 'SEARCH', {"count": 100, "query": "data.name:\"test.test\" AND type:\"domain\" AND name:\"reseller.pb\""})
.replyWithFile(200, __dirname + '/fixtures/info/found.json');
nock(test.mock.admin)
.get('/user/aaaa11112222333344445555', {})
.replyWithFile(200, __dirname + '/fixtures/user/_nkbt.json');
payment.checkAvailability(['test.test'], function (error) {
expect(error).not.to.be.null;
expect(error.message).to.be.equal('Domain has been already registered: test.test');
done();
});
});
@koresar
Copy link

koresar commented Feb 20, 2014

        it('should return error if at least one domain is unavailable', function (done) {
            nock(test.mock.user)
                .intercept('/info', 'SEARCH', {"count": 100, "query": "data.name:\"test.test\" AND type:\"domain\" AND name:\"reseller.pb\""})
                .replyWithFile(200, __dirname + '/fixtures/info/found.json');
            nock(test.mock.admin)
                .get('/user/aaaa11112222333344445555', {})
                .replyWithFile(200, __dirname + '/fixtures/user/_nkbt.json');
                        var expectedError;

            payment.checkAvailability(['test.test'], function (error) {
                                expectedError = error;
                done();
            });

                        expect(expectedError).not.to.be.null;
            expectedError.message.should.be.equal('Domain has been already registered: test.test');                        
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment