mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-03-10 22:44:09 +00:00
Fix for unit tests
This commit is contained in:
parent
6274c90a33
commit
ceda238507
@ -144,7 +144,7 @@ export class MockedDrawingService {
|
||||
return of(drawing);
|
||||
}
|
||||
|
||||
updatePosition(_server: Server, _drawing: Drawing, _x: number, _y: number) {
|
||||
updatePosition(_server: Server, _project: Project, _drawing: Drawing, _x: number, _y: number) {
|
||||
return of(this.drawing);
|
||||
}
|
||||
|
||||
|
@ -8,17 +8,20 @@ import { Drawing } from '../cartography/models/drawing';
|
||||
import { getTestServer } from './testing';
|
||||
import { DrawingService } from './drawing.service';
|
||||
import { AppTestingModule } from '../testing/app-testing/app-testing.module';
|
||||
import { Project } from '../models/project';
|
||||
import { SvgToDrawingConverter } from '../cartography/helpers/svg-to-drawing-converter';
|
||||
|
||||
describe('DrawingService', () => {
|
||||
let httpClient: HttpClient;
|
||||
let httpTestingController: HttpTestingController;
|
||||
let httpServer: HttpServer;
|
||||
let server: Server;
|
||||
let project: Project = new Project();
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule, AppTestingModule],
|
||||
providers: [HttpServer, DrawingService]
|
||||
providers: [HttpServer, SvgToDrawingConverter, DrawingService]
|
||||
});
|
||||
|
||||
httpClient = TestBed.get(HttpClient);
|
||||
@ -40,7 +43,7 @@ describe('DrawingService', () => {
|
||||
drawing.project_id = 'myproject';
|
||||
drawing.drawing_id = 'id';
|
||||
|
||||
service.updatePosition(server, drawing, 10, 20).subscribe();
|
||||
service.updatePosition(server, project, drawing, 10, 20).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
@ -55,7 +58,7 @@ describe('DrawingService', () => {
|
||||
drawing.project_id = 'myproject';
|
||||
drawing.drawing_id = 'id';
|
||||
|
||||
service.updatePosition(server, drawing, 10.1, 20.6).subscribe();
|
||||
service.updatePosition(server, project, drawing, 10.1, 20.6).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/drawings/id');
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
|
@ -154,11 +154,14 @@ describe('NodeService', () => {
|
||||
}));
|
||||
|
||||
it('should updatePosition of node', inject([NodeService], (service: NodeService) => {
|
||||
let project = {
|
||||
project_id: '1'
|
||||
} as Project;
|
||||
const node = new Node();
|
||||
node.project_id = 'myproject';
|
||||
node.node_id = 'id';
|
||||
|
||||
service.updatePosition(server, node, 10, 20).subscribe();
|
||||
service.updatePosition(server, project, node, 10, 20).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
@ -169,11 +172,14 @@ describe('NodeService', () => {
|
||||
}));
|
||||
|
||||
it('should updatePosition of node and round to integer', inject([NodeService], (service: NodeService) => {
|
||||
let project = {
|
||||
project_id: '1'
|
||||
} as Project;
|
||||
const node = new Node();
|
||||
node.project_id = 'myproject';
|
||||
node.node_id = 'id';
|
||||
|
||||
service.updatePosition(server, node, 10.1, 20.6).subscribe();
|
||||
service.updatePosition(server, project, node, 10.1, 20.6).subscribe();
|
||||
|
||||
const req = httpTestingController.expectOne('http://127.0.0.1:3080/v2/projects/myproject/nodes/id');
|
||||
expect(req.request.method).toEqual('PUT');
|
||||
|
Loading…
x
Reference in New Issue
Block a user