Got rid of tests.

This commit is contained in:
smartapant 2016-04-20 17:00:18 +03:00
parent 6558ee2fc4
commit 1ecaf82998
16 changed files with 2 additions and 710 deletions

View file

@ -1,29 +0,0 @@
import {
it,
inject,
injectAsync,
describe,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {Component, provide} from 'angular2/core';
// Load the implementations that should be tested
import {About} from './about.component';
describe('About', () => {
// provide our implementations or mocks to the dependency injector
beforeEachProviders(() => [
About
]);
it('should log ngOnInit', inject([ About ], (about) => {
spyOn(console, 'log');
expect(console.log).not.toHaveBeenCalled();
about.ngOnInit();
expect(console.log).toHaveBeenCalled();
}));
});

View file

@ -1,32 +0,0 @@
describe('App', () => {
beforeEach(() => {
browser.get('/');
});
it('should have a title', () => {
let subject = browser.getTitle();
let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass';
expect(subject).toEqual(result);
});
it('should have <header>', () => {
let subject = element(by.css('app header')).isPresent();
let result = true;
expect(subject).toEqual(result);
});
it('should have <main>', () => {
let subject = element(by.css('app main')).isPresent();
let result = true;
expect(subject).toEqual(result);
});
it('should have <footer>', () => {
let subject = element(by.css('app footer')).getText();
let result = 'WebPack Angular 2 Starter by @AngularClass';
expect(subject).toEqual(result);
});
});

View file

@ -1,24 +0,0 @@
import {
it,
inject,
injectAsync,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
// Load the implementations that should be tested
import {App} from './app.component';
import {AppState} from './app.service';
describe('App', () => {
// provide our implementations or mocks to the dependency injector
beforeEachProviders(() => [
AppState,
App
]);
it('should have a url', inject([ App ], (app) => {
expect(app.url).toEqual('https://twitter.com/AngularClass');
}));
});

View file

@ -1,22 +0,0 @@
describe('App', () => {
beforeEach(() => {
// change hash depending on router LocationStrategy
browser.get('/#/home');
});
it('should have a title', () => {
let subject = browser.getTitle();
let result = 'Angular2 Webpack Starter by @gdi2290 from @AngularClass';
expect(subject).toEqual(result);
});
it('should have `your content here` x-large', () => {
let subject = element(by.css('[x-large]')).getText();
let result = 'Your Content Here';
expect(subject).toEqual(result);
});
});

View file

@ -1,52 +0,0 @@
import {
it,
inject,
injectAsync,
describe,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {Component, provide} from 'angular2/core';
import {BaseRequestOptions, Http} from 'angular2/http';
import {MockBackend} from 'angular2/http/testing';
// Load the implementations that should be tested
import {Home} from './home.component';
import {Title} from './title';
import {AppState} from '../app.service';
describe('Home', () => {
// provide our implementations or mocks to the dependency injector
beforeEachProviders(() => [
BaseRequestOptions,
MockBackend,
provide(Http, {
useFactory: function(backend, defaultOptions) {
return new Http(backend, defaultOptions);
},
deps: [MockBackend, BaseRequestOptions]
}),
AppState,
Title,
Home
]);
it('should have default data', inject([ Home ], (home) => {
expect(home.localState).toEqual({ value: '' });
}));
it('should have a title', inject([ Home ], (home) => {
expect(!!home.title).toEqual(true);
}));
it('should log ngOnInit', inject([ Home ], (home) => {
spyOn(console, 'log');
expect(console.log).not.toHaveBeenCalled();
home.ngOnInit();
expect(console.log).toHaveBeenCalled();
}));
});

View file

@ -1,44 +0,0 @@
import {
it,
inject,
injectAsync,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {Component, provide} from 'angular2/core';
import {BaseRequestOptions, Http} from 'angular2/http';
import {MockBackend} from 'angular2/http/testing';
import {Title} from './title.service';
describe('Title', () => {
beforeEachProviders(() => [
BaseRequestOptions,
MockBackend,
provide(Http, {
useFactory: function(backend, defaultOptions) {
return new Http(backend, defaultOptions);
},
deps: [MockBackend, BaseRequestOptions]
}),
Title
]);
it('should have http', inject([ Title ], (title) => {
expect(!!title.http).toEqual(true);
}));
it('should get data from the server', inject([ Title ], (title) => {
spyOn(console, 'log');
expect(console.log).not.toHaveBeenCalled();
title.getData();
expect(console.log).toHaveBeenCalled();
expect(title.getData()).toEqual({ value: 'AngularClass' });
}));
});

View file

@ -1,34 +0,0 @@
import {
it,
inject,
injectAsync,
describe,
beforeEachProviders,
TestComponentBuilder
} from 'angular2/testing';
import {Component, provide} from 'angular2/core';
import {BaseRequestOptions, Http} from 'angular2/http';
import {MockBackend} from 'angular2/http/testing';
// Load the implementations that should be tested
import {XLarge} from './x-large.directive';
describe('x-large directive', () => {
// Create a test component to test directives
@Component({
template: '',
directives: [ XLarge ]
})
class TestComponent {}
it('should sent font-size to x-large', injectAsync([TestComponentBuilder], (tcb) => {
return tcb.overrideTemplate(TestComponent, '<div x-large>Content</div>')
.createAsync(TestComponent).then((fixture: any) => {
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement.children[0];
expect(compiled.style.fontSize).toBe('x-large');
});
}));
});