Ejemplo n.º 1
0
        it ('should return error on fatal', function () {
            // given
            var client = jasmine.createSpy();
            var err = new Error();
            ClientFactory.create.andCallFake(function (cb) {
                return cb(err);
            });

            // when
            spec.Run(function (spy) {
                genericPool.acquire(spy)
            }).thenExpect(function (spy) {
                expect(spy).toHaveBeenCalledWith(err);
            });


        });
Ejemplo n.º 2
0
        it ('should return envelope with client created by clientFactory', function () {
            // given
            var client = jasmine.createSpy();

            ClientFactory.create.andCallFake(function (cb) {
                return cb(null, client);
            });

            // when
            var retClient;
            spec.Run(function (spy) {
                genericPool.acquire(function (err, res) {
                    retClient = res;
                    spy(null, res);
                });
            }).thenExpect(function (spy) {
                expect(retClient.client).toBe(client);
            });


        });