refactor(frontend): separate furniture inventory client (#7)
This commit is contained in:
1 parent
b030ac579a
commit
ef04cbe45b
14 files changed
+263
-207
No files matched your search
@@ -0,0 +1,30 @@
|
||||
import { provideHttpClient } from '@angular/common/http';
|
||||
import { HttpTestingController, provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { FurnitureInventoryService } from './furniture-inventory.service';
|
||||
|
||||
describe('FurnitureInventoryService', () => {
|
||||
let service: FurnitureInventoryService;
|
||||
let http: HttpTestingController;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [provideHttpClient(), provideHttpClientTesting()],
|
||||
});
|
||||
service = TestBed.inject(FurnitureInventoryService);
|
||||
http = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
|
||||
afterEach(() => http.verify());
|
||||
|
||||
it('uses the versioned furniture-inventory contract', () => {
|
||||
service.getInventory('lease-1').subscribe();
|
||||
http.expectOne('/api/leases/lease-1/inventory').flush({});
|
||||
|
||||
service.saveInventory('lease-1', { version: 4, lines: [] }).subscribe();
|
||||
const request = http.expectOne('/api/leases/lease-1/inventory');
|
||||
expect(request.request.method).toBe('PUT');
|
||||
expect(request.request.body).toEqual({ version: 4, lines: [] });
|
||||
request.flush({});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user