How to use the rx/dist/rx.testing.Observable function in rx

To help you get started, we’ve selected a few rx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AdamNowotny / BuildReactor / src / services / cctray / cctrayRequests.spec.js View on Github external
it('should return response', () => {
            spyOn(request, 'get').and.returnValue(
                Rx.Observable.return({ body: { Projects: { Project: [] } } })
            );

            const result = scheduler.startScheduler(() => cctrayRequests.projects(settings));

            expect(result.messages).toHaveEqualElements(
                onNext(200, { Projects: { Project: [] } }),
                onCompleted(200)
            );
        });
github AdamNowotny / BuildReactor / src / core / services / serviceController.spec.js View on Github external
it('should not start disabled services', function() {
				settings.disabled = true;

				controller.start(Rx.Observable.return([settings]));

				expect(CustomBuildService.prototype.start).not.toHaveBeenCalled();
			});
github AdamNowotny / BuildReactor / src / core / notificationController.spec.js View on Github external
case 'servicesInitialized':
                    return servicesInitializedEvents;
                case 'passwordExpired':
                    return passwordExpiredEvents;
                default:
                    return null;
            }
        });
        scheduler = new Rx.TestScheduler();
        mockNotification = {
            close: jasmine.createSpy(),
            onshow: jasmine.createSpy(),
            onclick: jasmine.createSpy()
        };
        spyOn(window, 'Notification').and.returnValue(mockNotification);
        spyOn(chromeApi, 'isDashboardActive').and.returnValue(Rx.Observable.return(false));
        spyOn(serviceController, 'typeInfoFor').and
            .returnValue({ icon: 'src/services/test/icon.png' });
        notificationController.init({
            timeout: 5000,
            scheduler,
            configuration: configChanges
        });
    });
github AdamNowotny / BuildReactor / src / services / jenkins / jenkins.spec.js View on Github external
it('should pass request parameters', () => {
            requests.jobs.returns(Rx.Observable.empty());

            jenkins.getAll(settings);

            sinon.assert.calledOnce(requests.jobs);
            sinon.assert.calledWith(requests.jobs, { url: settings.url, settings });
        });
github AdamNowotny / BuildReactor / src / services / travis / travisRequests.spec.js View on Github external
it('should return sequence if json array present', () => {
            spyOn(request, 'get').and.returnValue(Rx.Observable.return({
                body: {
                    repositories: [
                        { org: 1 }, { org: 2 }
                    ]
                }
            }));

            const result = scheduler.startScheduler(() => travisRequests.repositories(settings));

            expect(result.messages).toHaveEqualElements(
                onNext(200, { org: 1 }),
                onNext(200, { org: 2 }),
                onCompleted(200)
            );
        });
github AdamNowotny / BuildReactor / src / core / services / serviceController.spec.js View on Github external
beforeEach(function() {
        settings = {
            baseUrl: 'test',
            url: 'http://www.example.com/',
            name: 'service name',
            projects: [],
            disabled: false
        };
        serviceStartResponse = Rx.Observable.return([]);
        spyOn(CustomBuildService.prototype, 'start').and.callFake(function() {
            this.events.onNext({ eventName: 'serviceStarted' });
            return serviceStartResponse;
        });
        spyOn(CustomBuildService.prototype, 'stop');
        controller.registerType(CustomBuildService);
        scheduler = new Rx.TestScheduler();

    });
github AdamNowotny / BuildReactor / src / core / services / travis / travisBuild.spec.js View on Github external
request.json.and.callFake(function(options) {
				switch (options.url) {
				case 'https://api.travis-ci.org/repositories/AdamNowotny/BuildReactor/builds.json':
					return Rx.Observable.return(buildsRunningJson);
				case 'https://api.travis-ci.org/builds/6305554':
					return build1Result;
				case 'https://api.travis-ci.org/builds/6305490':
					return build2Result;
				default:
					throw 'Unknown URL ' + options.url;
				}
			});
github AdamNowotny / BuildReactor / src / services / bamboo / bambooRequests.spec.js View on Github external
spyOn(request, 'get').and.callFake((data) => {
                expect(data).toEqual({
                    url: 'http://example.com/rest/api/latest/project',
                    query: {
                        expand: 'projects.project.plans.plan',
                        'max-result': 1000,
                        os_authType: 'basic'
                    },
                    type: 'json',
                    username: settings.username,
                    password: settings.password
                });
                return Rx.Observable.never();
            });
github AdamNowotny / BuildReactor / src / services / teamcity / teamcityRequests.spec.js View on Github external
spyOn(request, 'get').and.callFake((data) => {
                expect(data).toEqual({
                    url: 'http://example.com/httpAuth/app/rest/buildTypes',
                    query: {
                        fields: 'buildType(id,name,projectName)'
                    },
                    type: 'json',
                    username: settings.username,
                    password: settings.password
                });
                return Rx.Observable.never();
            });
github AdamNowotny / BuildReactor / src / services / buildbot / buildbotRequests.spec.js View on Github external
spyOn(request, 'get').and.callFake((data) => {
                expect(data).toEqual({
                    url: 'http://example.com/json/builders',
                    type: 'json',
                    username: settings.username,
                    password: settings.password
                });
                return Rx.Observable.never();
            });