File tree Expand file tree Collapse file tree
ui/src/infrastructure/client Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import {
2+ provideHttpClient
3+ } from '@angular/common/http' ;
4+ import {
5+ HttpTestingController ,
6+ provideHttpClientTesting
7+ } from '@angular/common/http/testing' ;
8+ import {
9+ TestBed
10+ } from '@angular/core/testing' ;
11+
12+ import {
13+ ApplicationInfoClient
14+ } from './application-info.client' ;
15+
16+ describe ( 'ApplicationInfoClient' , ( ) => {
17+ let client : ApplicationInfoClient ;
18+ let httpTestingController : HttpTestingController ;
19+
20+ beforeEach ( ( ) => {
21+ TestBed . configureTestingModule ( {
22+ providers : [
23+ ApplicationInfoClient ,
24+ provideHttpClient ( ) ,
25+ provideHttpClientTesting ( )
26+ ]
27+ } ) ;
28+
29+ client = TestBed . inject ( ApplicationInfoClient ) ;
30+
31+ httpTestingController =
32+ TestBed . inject ( HttpTestingController ) ;
33+ } ) ;
34+
35+ afterEach ( ( ) => {
36+ httpTestingController . verify ( ) ;
37+ } ) ;
38+
39+ it ( 'should retrieve the application version' , ( ) => {
40+ client . getVersion ( ) . subscribe ( version => {
41+ expect ( version ) . toBe ( '0.4.12' ) ;
42+ } ) ;
43+
44+ const request =
45+ httpTestingController . expectOne ( '/actuator/info' ) ;
46+
47+ expect ( request . request . method ) . toBe ( 'GET' ) ;
48+
49+ request . flush ( {
50+ build : {
51+ version : '0.4.12'
52+ }
53+ } ) ;
54+ } ) ;
55+ } ) ;
Original file line number Diff line number Diff line change 1- import { HttpClient } from '@angular/common/http' ;
2- import { Injectable } from '@angular/core' ;
3- import { map , Observable } from 'rxjs' ;
1+ import {
2+ HttpClient
3+ } from '@angular/common/http' ;
4+ import {
5+ Injectable
6+ } from '@angular/core' ;
7+ import {
8+ map ,
9+ Observable
10+ } from 'rxjs' ;
411
512interface ApplicationInfoResponse {
613 build : {
You can’t perform that action at this time.
0 commit comments