Skip to content

Instantly share code, notes, and snippets.

View FunnyGhost's full-sized avatar
💭
💻 🐵

Catalin Ciubotaru FunnyGhost

💭
💻 🐵
View GitHub Profile
@FunnyGhost
FunnyGhost / cloudSettings
Last active August 20, 2020 09:11
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-08-20T09:11:43.945Z","extensionVersion":"v3.4.3"}
it('should add the values', () => {
const result = addValues(2, 4);
expect(result).toBe(6);
});
let addValues = (value1, value2) {}
it('should add the values', () => {
const result = addValues(2, 4);
expect(result).toBe(6);
});
let addValues = (value1, value2) {
return value1 + value2;
}
describe('Render', () => {
beforeEach(() => {
fixture.detectChanges();
});
it('should have a title', () => {
const titleElements = fixture.debugElement.queryAll(By.css('h1'));
expect(titleElements.length).toBe(1);
expect(titleElements[0].nativeElement.innerHTML).toBe('Favorite movies');
it('show all the favorite movies', () => {
const movieElements = fixture.debugElement.queryAll(By.css('.movie'));
expect(movieElements.length).toBe(favoriteMoviesToUse.length);
});
const favoriteMoviesToUse: Movie[] = [
{ title: 'Interstellar' } as Movie,
{ title: 'The big Lebowski' } as Movie,
{ title: 'Fences' } as Movie
];
describe('FavoriteMoviesComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(FavoriteMoviesComponent);
component = fixture.componentInstance;
<div class="movie" *ngFor="let movie of favoriteMovies">
{{ movie.title }}
</div>
const favoriteMoviesToUse: Movie[] = [
{ title: 'Interstellar' } as Movie,
{ title: 'The big Lebowski' } as Movie,
{ title: 'Borat' } as Movie
];
describe('FavoriteMoviesComponent', () => {
let component: FavoriteMoviesComponent;
let fixture: ComponentFixture<FavoriteMoviesComponent>;
let favoriteMovieService: FavoriteMoviesService;
@Component({
selector: 'app-favorite-movies',
templateUrl: './favorite-movies.component.html',
styleUrls: ['./favorite-movies.component.scss']
})
export class FavoriteMoviesComponent implements OnInit {
favoriteMovies$: Observable<Movie[]>;
error: string;
constructor(private favoriteMovieService: FavoriteMoviesService) {}