summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/shared/api/motd.service.spec.ts
blob: e186e8423ec86df9816825beb1402a2d5bb0f761 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
import { TestBed } from '@angular/core/testing';

import { MotdService } from '~/app/shared/api/motd.service';
import { configureTestBed } from '~/testing/unit-test-helper';

describe('MotdService', () => {
  let service: MotdService;
  let httpTesting: HttpTestingController;

  configureTestBed({
    imports: [HttpClientTestingModule],
    providers: [MotdService]
  });

  beforeEach(() => {
    service = TestBed.inject(MotdService);
    httpTesting = TestBed.inject(HttpTestingController);
  });

  afterEach(() => {
    httpTesting.verify();
  });

  it('should be created', () => {
    expect(service).toBeTruthy();
  });

  it('should get MOTD', () => {
    service.get().subscribe();
    const req = httpTesting.expectOne('ui-api/motd');
    expect(req.request.method).toBe('GET');
  });
});