Skip to content

Instantly share code, notes, and snippets.

💭
💻 🐵

Catalin Ciubotaru FunnyGhost

💭
💻 🐵
Block or report user

Report or block FunnyGhost

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FunnyGhost
FunnyGhost / cloudSettings
Last active Nov 14, 2019
Visual Studio Code Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-11-14T10:28:04.310Z","extensionVersion":"v3.4.3"}
View simple-test.js
it('should add the values', () => {
const result = addValues(2, 4);
expect(result).toBe(6);
});
let addValues = (value1, value2) {}
View passing-test.js
it('should add the values', () => {
const result = addValues(2, 4);
expect(result).toBe(6);
});
let addValues = (value1, value2) {
return value1 + value2;
}
View favorite-movies.component.spec.ts
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');
View show-all-movies-test.js
it('show all the favorite movies', () => {
const movieElements = fixture.debugElement.queryAll(By.css('.movie'));
expect(movieElements.length).toBe(favoriteMoviesToUse.length);
});
View favorite-movies.component.spec.ts
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;
View favorite-movies.component.html
<div class="movie" *ngFor="let movie of favoriteMovies">
{{ movie.title }}
</div>
View favorite-movies.component.spec.ts
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;
View favorite-movies.component.ts
@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) {}
You can’t perform that action at this time.