Skip to content

Commit 9b0596e

Browse files
[fix]UT
1 parent c4dabff commit 9b0596e

4 files changed

Lines changed: 27 additions & 29 deletions

File tree

‎test/leaflet/overlay/GraphMapSpec.js‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ describe('GraphMap leaflet', () => {
3737
}
3838
});
3939
var graphMap = new GraphMap(knowledgegraphmapURL);
40-
graphMap.on('loaded',()=>{
40+
graphMap.on('loaded', () => {
4141
expect(graphMap).not.toBeNull();
4242
done();
43-
})
44-
43+
});
4544
});
4645
it('findShortestPath', (done) => {
4746
spyOn(FetchRequest, 'get').and.callFake((testUrl) => {
@@ -64,18 +63,18 @@ describe('GraphMap leaflet', () => {
6463
expect(graphMap).not.toBeNull();
6564
spyOn(graphMap.graph, 'highlight');
6665
spyOn(graphMap.graph, 'clearHighlight');
67-
knowledgeGraphService.findShortestPath({ startid: 38756, endid: 38757 }, (res) => {
66+
graphMap.findShortestPath({ startid: 38756, endid: 38757 }, (res) => {
6867
expect(res).not.toBeNull();
6968
expect(res.type).toBe('processCompleted');
7069
expect(res.result).not.toBeNull();
7170
expect(res.result.nodeIDs).toEqual([40229, 40237, 64058]);
7271
expect(res.result.edgeIDs).toEqual([69575, 66619]);
72+
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
73+
expect(graphMap.graph.highlight).toHaveBeenCalled();
74+
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
75+
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
76+
done();
7377
});
74-
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
75-
expect(graphMap.graph.highlight).toHaveBeenCalled();
76-
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
77-
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
78-
done();
7978
} catch (exception) {
8079
console.log("'findShortestPath'案例失败:" + exception.name + ':' + exception.message);
8180
expect(false).toBeTruthy();

‎test/mapboxgl/overlay/GraphMapSpec.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ describe('GraphMap mapboxgl', () => {
6464
expect(graphMap).not.toBeNull();
6565
spyOn(graphMap.graph, 'highlight');
6666
spyOn(graphMap.graph, 'clearHighlight');
67-
knowledgeGraphService.findShortestPath({ startid: 38756, endid: 38757 }, (res) => {
67+
graphMap.findShortestPath({ startid: 38756, endid: 38757 }, (res) => {
6868
expect(res).not.toBeNull();
6969
expect(res.type).toBe('processCompleted');
7070
expect(res.result).not.toBeNull();
7171
expect(res.result.nodeIDs).toEqual([40229, 40237, 64058]);
7272
expect(res.result.edgeIDs).toEqual([69575, 66619]);
73+
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
74+
expect(graphMap.graph.highlight).toHaveBeenCalled();
75+
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
76+
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
77+
done();
7378
});
74-
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
75-
expect(graphMap.graph.highlight).toHaveBeenCalled();
76-
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
77-
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
78-
done();
7979
} catch (exception) {
8080
console.log("'findShortestPath'案例失败:" + exception.name + ':' + exception.message);
8181
expect(false).toBeTruthy();

‎test/maplibregl/overlay/GraphMapSpec.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,17 @@ describe('GraphMap maplibregl', () => {
6363
expect(graphMap).not.toBeNull();
6464
spyOn(graphMap.graph, 'highlight');
6565
spyOn(graphMap.graph, 'clearHighlight');
66-
knowledgeGraphService.findShortestPath({ startID: 38756, endID: 38757 }, (res) => {
66+
graphMap.findShortestPath({ startID: 38756, endID: 38757 }, (res) => {
6767
expect(res).not.toBeNull();
6868
expect(res.type).toBe('processCompleted');
6969
expect(res.result).not.toBeNull();
7070
expect(res.result.nodeIDs).toEqual([40229, 40237, 64058]);
7171
expect(res.result.edgeIDs).toEqual([69575, 66619]);
72+
expect(graphMap.graph.highlight).toHaveBeenCalled();
73+
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
74+
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
75+
done();
7276
});
73-
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
74-
expect(graphMap.graph.highlight).toHaveBeenCalled();
75-
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
76-
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
77-
done();
7877
} catch (exception) {
7978
console.log("'findShortestPath'案例失败:" + exception.name + ':' + exception.message);
8079
expect(false).toBeTruthy();

‎test/openlayers/overlay/GraphMapSpec.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ describe('GraphMap openlayers', () => {
3737
}
3838
});
3939
var graphMap = new GraphMap(knowledgegraphmapURL);
40-
graphMap.on('loaded',()=>{
40+
graphMap.on('loaded', () => {
4141
expect(graphMap).not.toBeNull();
4242
done();
43-
})
43+
});
4444
});
4545
it('findShortestPath', (done) => {
4646
spyOn(FetchRequest, 'get').and.callFake((testUrl) => {
@@ -63,18 +63,18 @@ describe('GraphMap openlayers', () => {
6363
expect(graphMap).not.toBeNull();
6464
spyOn(graphMap.graph, 'highlight');
6565
spyOn(graphMap.graph, 'clearHighlight');
66-
knowledgeGraphService.findShortestPath({ startid: 38756, endid: 38757 }, (res) => {
66+
graphMap.findShortestPath({ startid: 38756, endid: 38757 }, (res) => {
6767
expect(res).not.toBeNull();
6868
expect(res.type).toBe('processCompleted');
6969
expect(res.result).not.toBeNull();
7070
expect(res.result.nodeIDs).toEqual([40229, 40237, 64058]);
7171
expect(res.result.edgeIDs).toEqual([69575, 66619]);
72+
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
73+
expect(graphMap.graph.highlight).toHaveBeenCalled();
74+
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
75+
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
76+
done();
7277
});
73-
graphMap.highlight({ nodeIDs: [40229], edgeIDs: [69575] });
74-
expect(graphMap.graph.highlight).toHaveBeenCalled();
75-
graphMap.clearHighlight({ nodeIDs: [40229], edgeIDs: [69575] });
76-
expect(graphMap.graph.clearHighlight).toHaveBeenCalled();
77-
done();
7878
} catch (exception) {
7979
console.log("'findShortestPath'案例失败:" + exception.name + ':' + exception.message);
8080
expect(false).toBeTruthy();

0 commit comments

Comments
 (0)