Skip to content

Commit 5e416be

Browse files
committed
【fix】UT review by qiwei
1 parent 613c855 commit 5e416be

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

test/common/thirdparty/ai/BinaryClassificationSpec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ describe('binary classification', () => {
1111
testImage.src = image.src;
1212
window.document.body.appendChild(testImage);
1313
});
14+
afterAll(() => {
15+
window.document.body.removeChild(testImage);
16+
});
1417
it('predict', (done) => {
1518
var params = {
1619
modelUrl: 'http://fakeurl/model.json',

test/common/thirdparty/ai/LandcoverClassificationSpec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ describe('landcover classification', () => {
1111
testImage.src = image.src;
1212
window.document.body.appendChild(testImage);
1313
});
14+
afterAll(() => {
15+
window.document.body.removeChild(testImage);
16+
});
1417
it('predict', (done) => {
1518
var params = {
1619
modelUrl: 'http://fakeurl/model.json',

test/common/thirdparty/ai/ObjectDetectionSpec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ describe('object detection', () => {
1111
testImage.src = image.src;
1212
window.document.body.appendChild(testImage);
1313
});
14+
afterAll(() => {
15+
window.document.body.removeChild(testImage);
16+
});
1417
it('predict', (done) => {
1518
var params = {
1619
modelUrl: 'http://fakeurl/model.json',

test/common/thirdparty/ai/WebMachineLearningSpec.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BinaryClassification } from '../../../../src/common/thirdparty/ai/BinaryClassification';
22
import { WebMachineLearning } from '../../../../src/common/thirdparty/ai/WebMachineLearning';
3+
import image from '../../../resources/img/baiduTileTest.png';
34
import * as tfconv from '@tensorflow/tfjs-converter';
45
import * as tfcore from '@tensorflow/tfjs-core';
56

@@ -8,13 +9,15 @@ describe('WebMachineLearning', () => {
89
beforeAll(() => {
910
testImage = window.document.createElement('img');
1011
testImage.id = 'demo';
11-
testImage.src = testImage;
12+
testImage.src = image.src;
1213
window.document.body.appendChild(testImage);
1314
});
14-
15+
afterAll(() => {
16+
window.document.body.removeChild(testImage);
17+
});
1518
it('predict', (done) => {
1619
var params = {
17-
modelUrl: 'http://192.168.11.148:8080/model.json',
20+
modelUrl: 'ttp://fakeurl/model.json',
1821
image: window.document.querySelector('#demo')
1922
};
2023
var binaryClassification = new BinaryClassification(params);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy