コード例 #1
0
ファイル: GenericPoolSpec.js プロジェクト: kvlar/flexi-pool
        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);
            });


        });
コード例 #2
0
ファイル: GenericPoolSpec.js プロジェクト: kvlar/flexi-pool
        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);
            });


        });