This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {TestBed} from '@angular/core/testing'; | |
import {ExampleService} from './example.service'; | |
import {HttpClientTestingModule, HttpTestingController} from '@angular/common/http/testing'; | |
import {HttpClient} from '@angular/common/http'; | |
describe('ExampleService', () => { | |
let service: ExampleService; | |
let httpTestingController: HttpTestingController; | |
const baseUrl = 'http://my.base.url'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { of } from 'rxjs'; | |
import { filter} from 'rxjs/operators'; | |
of(0815, 4711, 99, 98) | |
.pipe(filter((precinctNumber) => precinctNumber === 99)) | |
.subscribe((value) => console.log(`The coolest precinct: ${value}`)); | |
// Logs: | |
// The coolest precinct: 99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Detective { | |
id: string | |
} | |
interface Case { | |
id: string, | |
} | |
interface Report { | |
id: number, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private solvedCaseIds$ = this.reports$.pipe( | |
filter((report) => report.solved), | |
map((report) => report.id), | |
toArray() | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public solvedCaseIds$ = this.reports$.pipe( | |
extractIdsOfSolvedCases() | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function extractIdsOfSolvedCases() { | |
return function(source: Observable<Report>): Observable<number[]> { | |
return source.pipe( | |
filter((report) => report.solved), | |
map((report) => report.id), | |
toArray() | |
) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {extractIdsOfSolvedCases} from './rxjs-operators'; | |
import {marbles} from 'rxjs-marbles'; | |
import {Report} from './reports.service'; | |
describe('rxjs-operators', () => { | |
describe('extractIdsOfSolvedCases', () => { | |
it('should extract all ids of solved cases', marbles((context) => { | |
const source = context.cold('abc|', { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
branches: | |
- main #1 | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
name: Deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<mat-drawer-container autosize class="h-screen"> | |
<mat-drawer class="flex h-full flex-col justify-center overflow-x-hidden px-2" mode="side" opened="true"> | |
<app-sidebar></app-sidebar> | |
</mat-drawer> | |
<mat-drawer-content> | |
<!-- // random image to load --> | |
<img ngSrc="https://picsum.photos/200/300" width="200" height="300" alt="random Picture" priority /> | |
<app-navbar></app-navbar> | |
<router-outlet></router-outlet> | |
</mat-drawer-content> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>FitPlaner</title> | |
<base href="/" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<link rel="icon" type="image/x-icon" href="favicon.ico" /> | |
<link rel="preconnect" href="https://fonts.gstatic.com" /> |
OlderNewer