Comparar commits
5 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| a557f3500c | |||
| 1b91ce81be | |||
| c9b2ff0d7a | |||
| f9ace95cd8 | |||
| 8dfea49b81 |
+72
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"project": "./tsconfig.json"
|
||||
},
|
||||
"plugins": ["@typescript-eslint", "react"],
|
||||
"extends": [
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
],
|
||||
"rules": {
|
||||
"quotes": ["off", "double"],
|
||||
"@typescript-eslint/indent": [
|
||||
"off",
|
||||
2
|
||||
],
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/explicit-function-return-type": 0,
|
||||
"@typescript-eslint/no-parameter-properties": 0,
|
||||
"@typescript-eslint/no-use-before-define": 0,
|
||||
"@typescript-eslint/no-object-literal-type-assertion": 0,
|
||||
|
||||
"@typescript-eslint/await-thenable": "off",
|
||||
"@typescript-eslint/ban-types": "off",
|
||||
"@typescript-eslint/explicit-module-boundary-types": "off",
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-floating-promises": "off",
|
||||
"@typescript-eslint/no-implied-eval": "off",
|
||||
"@typescript-eslint/no-misused-promises": "off",
|
||||
"@typescript-eslint/no-non-null-assertion": "off",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "off",
|
||||
"@typescript-eslint/no-unsafe-assignment": "off",
|
||||
"@typescript-eslint/no-unsafe-call": "off",
|
||||
"@typescript-eslint/no-unsafe-member-access": "off",
|
||||
"@typescript-eslint/no-unsafe-return": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/prefer-regexp-exec": "off",
|
||||
"@typescript-eslint/require-await": "off",
|
||||
"@typescript-eslint/restrict-plus-operands": "off",
|
||||
"@typescript-eslint/restrict-template-expressions": "off",
|
||||
"@typescript-eslint/unbound-method": "off",
|
||||
"@typescript-eslint/no-inferrable-types": "off",
|
||||
|
||||
"no-extend-native":"off",
|
||||
"no-multi-str": "off",
|
||||
"no-template-curly-in-string": "off",
|
||||
"no-async-promise-executor": "off",
|
||||
"no-case-declarations": "off",
|
||||
"no-useless-escape": "off",
|
||||
"prefer-const": "off",
|
||||
"prefer-spread": "off",
|
||||
"react/no-find-dom-node": "off",
|
||||
"react/prop-types": "off",
|
||||
"react/jsx-no-target-blank": "off",
|
||||
"react/jsx-no-comment-textnodes": "off",
|
||||
"import/first": "off",
|
||||
"getter-return":"off",
|
||||
"dot-location": "off",
|
||||
"no-new-func": "off",
|
||||
|
||||
"jsx-a11y/anchor-is-valid": "off",
|
||||
"jsx-a11y/alt-text": "off",
|
||||
|
||||
"jest/no-identical-title": "off",
|
||||
"jest/valid-expect": "off",
|
||||
"jest/no-jasmine-globals": "off",
|
||||
"jest/no-conditional-expect": "off",
|
||||
"jest/valid-describe": "off"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -67,7 +67,7 @@ VoTT is available for Windows, Linux and OSX. Download the appropriate platform
|
||||
|
||||
### Build and run from source
|
||||
|
||||
VoTT requires [NodeJS (>= 10.x, Dubnium) and NPM](https://github.com/nodejs/Release)
|
||||
VoTT requires [NodeJS (>= 12.x, Dubnium) and NPM](https://github.com/nodejs/Release)
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Microsoft/VoTT.git
|
||||
|
||||
@@ -16,7 +16,7 @@ steps:
|
||||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '10.x'
|
||||
versionSpec: '12.x'
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
- bash: |
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '10.x'
|
||||
versionSpec: '12.x'
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
- bash: |
|
||||
|
||||
@@ -7,9 +7,9 @@ jobs:
|
||||
- template: git-pull-current-branch.yml
|
||||
|
||||
- task: NodeTool@0
|
||||
displayName: 'Use Node 10.x'
|
||||
displayName: 'Use Node 12.x'
|
||||
inputs:
|
||||
versionSpec: 10.x
|
||||
versionSpec: 12.x
|
||||
|
||||
- bash: |
|
||||
set -ex
|
||||
|
||||
@@ -7,9 +7,9 @@ jobs:
|
||||
- template: git-pull-current-branch.yml
|
||||
|
||||
- task: NodeTool@0
|
||||
displayName: 'Use Node 10.x'
|
||||
displayName: 'Use Node 12.x'
|
||||
inputs:
|
||||
versionSpec: 10.x
|
||||
versionSpec: 12.x
|
||||
|
||||
- task: Npm@1
|
||||
displayName: 'npm ci'
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: 10.x
|
||||
versionSpec: 12.x
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
# Download secure file
|
||||
|
||||
@@ -35,9 +35,9 @@ steps:
|
||||
displayName: "Verify storage account cred exists"
|
||||
|
||||
- task: NodeTool@0
|
||||
displayName: "Use Node 10.x"
|
||||
displayName: "Use Node 12.x"
|
||||
inputs:
|
||||
versionSpec: 10.x
|
||||
versionSpec: 12.x
|
||||
|
||||
- task: Npm@1
|
||||
displayName: 'Run `npm ci`'
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '10.x'
|
||||
versionSpec: '12.x'
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
- bash: |
|
||||
- bash: |
|
||||
set -e
|
||||
|
||||
|
||||
export DISPLAY=:99.0
|
||||
|
||||
npm ci # do a clean install
|
||||
|
||||
gerado
+12394
-10916
Diferenças do arquivo suprimidas por serem muito extensas
Carregar Diff
+35
-26
@@ -15,15 +15,15 @@
|
||||
"private": true,
|
||||
"main": "build/main.js",
|
||||
"dependencies": {
|
||||
"@azure/storage-blob": "^10.3.0",
|
||||
"@azure/storage-blob": "10.3.0",
|
||||
"@tensorflow/tfjs": "^1.0.3",
|
||||
"@types/snapsvg": "^0.4.35",
|
||||
"axios": "^0.18.0",
|
||||
"bootstrap": "^4.1.3",
|
||||
"buffer-reverse": "^1.0.1",
|
||||
"crypto-js": "^3.1.9-1",
|
||||
"dotenv": "^7.0.0",
|
||||
"express-request-id": "^1.4.1",
|
||||
"fibers": "^5.0.0",
|
||||
"google-protobuf": "^3.6.1",
|
||||
"jpeg-js": "^0.3.4",
|
||||
"json2csv": "^4.5.0",
|
||||
@@ -38,13 +38,15 @@
|
||||
"react": "^16.7.0",
|
||||
"react-appinsights": "^3.0.0-rc.5",
|
||||
"react-color": "^2.17.0",
|
||||
"react-dnd": "^5.0.0",
|
||||
"react-dnd-html5-backend": "^3.0.2",
|
||||
"react-dom": "^16.7.0",
|
||||
"react-jsonschema-form": "^1.3.0",
|
||||
"react-localization": "^1.0.13",
|
||||
"react-modal": "^3.8.1",
|
||||
"react-redux": "^5.1.1",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-scripts": "2.1.1",
|
||||
"react-router-dom": "4.3.1",
|
||||
"react-scripts": "4.0.0",
|
||||
"react-split-pane": "^0.1.87",
|
||||
"react-tag-input": "^6.1.0",
|
||||
"react-toastify": "^4.5.2",
|
||||
@@ -54,6 +56,7 @@
|
||||
"redux": "^4.0.1",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"sass": "^1.28.0",
|
||||
"shortid": "^2.2.14",
|
||||
"video-react": "^0.13.2",
|
||||
"vott-ct": "2.1.24",
|
||||
@@ -76,8 +79,8 @@
|
||||
"release-web": "npm run build && npm run webpack:prod",
|
||||
"release-ci": "bash ./scripts/build.sh",
|
||||
"release": "npm run build && npm run webpack:prod && electron-builder",
|
||||
"pretest": "./node_modules/.bin/tslint 'src/**/*.ts*'",
|
||||
"lintfix": "./node_modules/.bin/tslint 'src/**/*.ts*' --fix",
|
||||
"pretest": "npx eslint \"src/**/*.ts*\"",
|
||||
"lintfix": "npx eslint \"src/**/*.ts*\" --fix",
|
||||
"test": "react-scripts test --env=jsdom --silent",
|
||||
"test:ci": "cross-env CI=true npm run test",
|
||||
"test:coverage": "npm run test -- --coverage",
|
||||
@@ -88,51 +91,57 @@
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not ie <= 11",
|
||||
"not op_mini all"
|
||||
],
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fortawesome/fontawesome-free": "^5.5.0",
|
||||
"@types/axios": "^0.14.0",
|
||||
"@types/axios-mock-adapter": "^1.10.0",
|
||||
"@types/dotenv": "^6.1.0",
|
||||
"@types/enzyme": "^3.1.15",
|
||||
"@types/jest": "23.3.9",
|
||||
"@types/json2csv": "^4.4.0",
|
||||
"@types/node": "10.12.7",
|
||||
"@types/nock": "^11.1.0",
|
||||
"@types/node": "12.19.0",
|
||||
"@types/react": "16.7.6",
|
||||
"@types/react-dom": "16.0.9",
|
||||
"@types/react-jsonschema-form": "^1.0.12",
|
||||
"@types/react-router-dom": "^4.3.1",
|
||||
"@types/react-split-pane": "^0.1.67",
|
||||
"@types/react-toastify": "^4.0.1",
|
||||
"@types/react-router": "5.0.0",
|
||||
"@types/react-router-dom": "4.3.1",
|
||||
"@types/reactstrap": "^6.4.3",
|
||||
"@types/redux-logger": "^3.0.6",
|
||||
"@types/redux-mock-store": "^1.0.0",
|
||||
"@types/snapsvg": "^0.4.35",
|
||||
"axios-mock-adapter": "^1.19.0",
|
||||
"cross-env": "^5.2.0",
|
||||
"electron": "^3.0.13",
|
||||
"electron-builder": "^22.6.0",
|
||||
"electron": "^10.1.5",
|
||||
"electron-builder": "^22.9.1",
|
||||
"enzyme": "^3.7.0",
|
||||
"enzyme-adapter-react-16": "^1.7.0",
|
||||
"foreman": "^3.0.1",
|
||||
"jest-enzyme": "^7.0.1",
|
||||
"jquery": "^3.3.1",
|
||||
"nock": "^13.0.4",
|
||||
"node-sass": "^4.14.1",
|
||||
"popper.js": "^1.14.6",
|
||||
"redux-immutable-state-invariant": "^2.1.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-mock-store": "^1.5.3",
|
||||
"ts-loader": "^5.3.0",
|
||||
"tslint": "^5.11.0",
|
||||
"typescript": "^3.1.6",
|
||||
"webpack": "^4.19.1",
|
||||
"webpack-cli": "^3.1.2",
|
||||
"webpack-merge": "^4.1.5"
|
||||
"typescript": "^4.0.5",
|
||||
"webpack-cli": "^4.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.14.2",
|
||||
"npm": ">=6.4.1"
|
||||
"node": ">=12.19.0",
|
||||
"npm": ">=6.14.8"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ stages:
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: '10.x'
|
||||
versionSpec: '12.x'
|
||||
displayName: 'Install Node.js'
|
||||
|
||||
- script: |
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import axios, { AxiosResponse } from "axios";
|
||||
import axios from "axios";
|
||||
import HtmlFileReader from "./htmlFileReader";
|
||||
import { AssetService } from "../services/assetService";
|
||||
import { TFRecordsBuilder, FeatureType } from "../providers/export/tensorFlowRecords/tensorFlowBuilder";
|
||||
import MockFactory from "./mockFactory";
|
||||
import { AssetState, IAsset } from "../models/applicationState";
|
||||
import nock from 'nock';
|
||||
|
||||
describe("Html File Reader", () => {
|
||||
const assetTestCache = new Map<string, IAsset>();
|
||||
@@ -57,62 +58,41 @@ describe("Html File Reader", () => {
|
||||
describe("Download asset binaries", () => {
|
||||
it("Downloads a blob from the asset path", async () => {
|
||||
const asset = AssetService.createAssetFromFilePath("https://server.com/image.jpg");
|
||||
axios.get = jest.fn((url, config) => {
|
||||
return Promise.resolve<AxiosResponse>({
|
||||
config,
|
||||
headers: null,
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
data: new Blob(["Some binary data"]),
|
||||
});
|
||||
});
|
||||
nock("https://server.com")
|
||||
.get("/image.jpg")
|
||||
.reply(200, new Blob(["Some binary data"]));
|
||||
|
||||
const result = await HtmlFileReader.getAssetBlob(asset);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result).toBeInstanceOf(Blob);
|
||||
expect(axios.get).toBeCalledWith(asset.path, { responseType: "blob" });
|
||||
});
|
||||
|
||||
it("Rejects the promise when request receives non 200 result", async () => {
|
||||
const asset = AssetService.createAssetFromFilePath("https://server.com/image.jpg");
|
||||
axios.get = jest.fn((url, config) => {
|
||||
return Promise.resolve<AxiosResponse>({
|
||||
config,
|
||||
headers: null,
|
||||
status: 404,
|
||||
statusText: "Not Found",
|
||||
data: null,
|
||||
});
|
||||
});
|
||||
nock("https://server.com").get("/image.jpg").reply(404, null);
|
||||
|
||||
await expect(HtmlFileReader.getAssetBlob(asset)).rejects.not.toBeNull();
|
||||
expect(axios.get).toBeCalledWith(asset.path, { responseType: "blob" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("Download asset binaries array", () => {
|
||||
beforeEach(() => {
|
||||
axios.get = jest.fn((url, config) => {
|
||||
return Promise.resolve<AxiosResponse>({
|
||||
config,
|
||||
headers: null,
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
data: [1, 2, 3],
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("Downloads a byte array from the asset path", async () => {
|
||||
const asset = AssetService.createAssetFromFilePath("https://server.com/image.jpg");
|
||||
const imagePath = "https://server.com/image.jpg";
|
||||
nock("https://server.com")
|
||||
.get("/image.jpg")
|
||||
.reply(200, [1, 2, 3]);
|
||||
|
||||
const asset = AssetService.createAssetFromFilePath(imagePath);
|
||||
const result = await HtmlFileReader.getAssetArray(asset);
|
||||
expect(result).not.toBeNull();
|
||||
expect(result).toBeInstanceOf(ArrayBuffer);
|
||||
expect(axios.get).toBeCalledWith(asset.path, { responseType: "blob" });
|
||||
});
|
||||
|
||||
it("Test non valid asset type", async () => {
|
||||
const imageAsset = AssetService.createAssetFromFilePath("https://server.com/image.notsupported");
|
||||
const imagePath = "https://server.com/image.notsupported";
|
||||
axiosMock.onGet(imagePath).reply(200, [1, 2, 3]);
|
||||
|
||||
const imageAsset = AssetService.createAssetFromFilePath(imagePath);
|
||||
try {
|
||||
const result = await HtmlFileReader.readAssetAttributes(imageAsset);
|
||||
} catch (error) {
|
||||
@@ -128,23 +108,16 @@ describe("Html File Reader", () => {
|
||||
height: 1080,
|
||||
};
|
||||
|
||||
axios.get = jest.fn((url, config) => {
|
||||
const builder = new TFRecordsBuilder();
|
||||
builder.addFeature("image/height", FeatureType.Int64, expected.height);
|
||||
builder.addFeature("image/width", FeatureType.Int64, expected.width);
|
||||
const buffer = builder.build();
|
||||
const tfrecords = TFRecordsBuilder.buildTFRecords([buffer]);
|
||||
const builder = new TFRecordsBuilder();
|
||||
builder.addFeature("image/height", FeatureType.Int64, expected.height);
|
||||
builder.addFeature("image/width", FeatureType.Int64, expected.width);
|
||||
const buffer = builder.build();
|
||||
const tfrecords = TFRecordsBuilder.buildTFRecords([buffer]);
|
||||
|
||||
return Promise.resolve<AxiosResponse>({
|
||||
config,
|
||||
headers: null,
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
data: tfrecords,
|
||||
});
|
||||
});
|
||||
const assetPath = "https://server.com/image.tfrecord"
|
||||
axiosMock.onGet(assetPath).reply(200, tfrecords);
|
||||
|
||||
const imageAsset = AssetService.createAssetFromFilePath("https://server.com/image.tfrecord");
|
||||
const imageAsset = AssetService.createAssetFromFilePath(assetPath);
|
||||
const result = await HtmlFileReader.readAssetAttributes(imageAsset);
|
||||
|
||||
expect(result.width).toEqual(expected.width);
|
||||
@@ -159,23 +132,16 @@ describe("Html File Reader", () => {
|
||||
height: 1080,
|
||||
};
|
||||
|
||||
axios.get = jest.fn((url, config) => {
|
||||
const builder = new TFRecordsBuilder();
|
||||
builder.addFeature("image/height", FeatureType.Int64, expected.height);
|
||||
builder.addFeature("image/width", FeatureType.Int64, expected.width);
|
||||
const buffer = builder.build();
|
||||
const tfrecords = TFRecordsBuilder.buildTFRecords([buffer]);
|
||||
const builder = new TFRecordsBuilder();
|
||||
builder.addFeature("image/height", FeatureType.Int64, expected.height);
|
||||
builder.addFeature("image/width", FeatureType.Int64, expected.width);
|
||||
const buffer = builder.build();
|
||||
const tfrecords = TFRecordsBuilder.buildTFRecords([buffer]);
|
||||
|
||||
return Promise.resolve<AxiosResponse>({
|
||||
config,
|
||||
headers: null,
|
||||
status: 200,
|
||||
statusText: "OK",
|
||||
data: tfrecords,
|
||||
});
|
||||
});
|
||||
const assetPath = "https://server.com/image.tfrecord"
|
||||
axiosMock.onGet(assetPath).reply(200, tfrecords);
|
||||
|
||||
const imageAsset = AssetService.createAssetFromFilePath("https://server.com/image.tfrecord");
|
||||
const imageAsset = AssetService.createAssetFromFilePath(assetPath);
|
||||
const result = await HtmlFileReader.readAssetAttributes(imageAsset);
|
||||
|
||||
expect(result.width).toEqual(expected.width);
|
||||
|
||||
@@ -72,7 +72,7 @@ function registerContextMenu(browserWindow: BrowserWindow): void {
|
||||
const selectionMenu = Menu.buildFromTemplate([
|
||||
{ role: "copy", accelerator: "CmdOrCtrl+C" },
|
||||
{ type: "separator" },
|
||||
{ role: "selectall", accelerator: "CmdOrCtrl+A" },
|
||||
{ role: "selectAll", accelerator: "CmdOrCtrl+A" },
|
||||
]);
|
||||
|
||||
const inputMenu = Menu.buildFromTemplate([
|
||||
@@ -83,7 +83,7 @@ function registerContextMenu(browserWindow: BrowserWindow): void {
|
||||
{ role: "copy", accelerator: "CmdOrCtrl+C" },
|
||||
{ role: "paste", accelerator: "CmdOrCtrl+V" },
|
||||
{ type: "separator" },
|
||||
{ role: "selectall", accelerator: "CmdOrCtrl+A" },
|
||||
{ role: "selectAll", accelerator: "CmdOrCtrl+A" },
|
||||
]);
|
||||
|
||||
browserWindow.webContents.on("context-menu", (e, props) => {
|
||||
@@ -111,7 +111,7 @@ function registerContextMenu(browserWindow: BrowserWindow): void {
|
||||
{ role: "reload" },
|
||||
{ type: "separator" },
|
||||
{ role: "toggleDevTools" },
|
||||
{ role: "toggleFullScreen" },
|
||||
{ role: "togglefullscreen" },
|
||||
{ type: "separator" },
|
||||
{ role: "resetZoom" },
|
||||
{ role: "zoomIn" },
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class LocalFileSystem implements IStorageProvider {
|
||||
|
||||
public selectContainer(): Promise<string> {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const filePaths = dialog.showOpenDialog(this.browserWindow, {
|
||||
const filePaths = dialog.showOpenDialogSync(this.browserWindow, {
|
||||
title: strings.connections.providers.local.selectFolder,
|
||||
buttonLabel: strings.connections.providers.local.chooseFolder,
|
||||
properties: ["openDirectory", "createDirectory"],
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import { BingImageSearch, IBingImageSearchOptions, BingImageSearchAspectRatio } from "./bingImageSearch";
|
||||
import { IAsset, AssetType, AssetState } from "../../models/applicationState";
|
||||
import MD5 from "md5.js";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
|
||||
describe("Bing Image Search", () => {
|
||||
const options: IBingImageSearchOptions = {
|
||||
@@ -18,26 +19,21 @@ describe("Bing Image Search", () => {
|
||||
{ contentUrl: "http://images.com/image4.jpg" },
|
||||
];
|
||||
|
||||
axios.get = jest.fn(() => {
|
||||
return Promise.resolve({
|
||||
data: {
|
||||
value: assets,
|
||||
},
|
||||
});
|
||||
});
|
||||
const axiosMock = new MockAdapter(axios);
|
||||
|
||||
it("calls the Bing image search API", async () => {
|
||||
// tslint:disable-next-line:max-line-length
|
||||
const expectedUrl = `https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=${options.query}&aspect=${options.aspectRatio}`;
|
||||
axiosMock.onGet(expectedUrl).reply(200, { value: assets, });
|
||||
|
||||
const expectedHeaders = {
|
||||
headers: {
|
||||
"Ocp-Apim-Subscription-Key": options.apiKey,
|
||||
"Accept": "application/json",
|
||||
},
|
||||
"Ocp-Apim-Subscription-Key": options.apiKey,
|
||||
"Accept": "application/json",
|
||||
};
|
||||
|
||||
await provider.getAssets();
|
||||
expect(axios.get).toBeCalledWith(expectedUrl, expectedHeaders);
|
||||
expect(axiosMock.history.get[0].url).toEqual(expectedUrl);
|
||||
expect(axiosMock.history.get[0].headers).toEqual(expectedHeaders);
|
||||
});
|
||||
|
||||
it("returns parsed image assets", async () => {
|
||||
|
||||
@@ -72,16 +72,16 @@ describe("Active Learning Form", () => {
|
||||
};
|
||||
|
||||
// Set type to URL
|
||||
wrapper.find(Form).props().onChange({ formData: { modelPathType: ModelPathType.Url } });
|
||||
wrapper.find(Form).props().onChange({ formData: { modelPathType: ModelPathType.Url } } as any);
|
||||
// Set the remaining settings
|
||||
wrapper.find(Form).props().onChange({ formData });
|
||||
wrapper.find(Form).props().onChange({ formData } as any);
|
||||
expect(wrapper.state().formData).toEqual(formData);
|
||||
expect(onChangeHandler).toBeCalledWith(formData);
|
||||
});
|
||||
|
||||
it("submits form data to the registered submit handler", () => {
|
||||
const wrapper = createComponent();
|
||||
wrapper.find(Form).props().onSubmit({ formData: defaultProps.settings });
|
||||
wrapper.find(Form).props().onSubmit({ formData: defaultProps.settings } as any);
|
||||
|
||||
expect(onSubmitHandler).toBeCalledWith(defaultProps.settings);
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ describe("Editor Page Component", () => {
|
||||
|
||||
beforeAll(() => {
|
||||
registerToolbar();
|
||||
window["require"] = jest.fn(() => electronMock);
|
||||
window["require"] = jest.fn(() => electronMock) as any;
|
||||
|
||||
const editorMock = Editor as any;
|
||||
editorMock.prototype.addContentSource = jest.fn(() => Promise.resolve());
|
||||
|
||||
@@ -34,7 +34,7 @@ describe("Main Content Router", () => {
|
||||
it("renders correct routes", () => {
|
||||
const wrapper = shallow(<MainContentRouter />);
|
||||
const pathMap = wrapper.find(Route).reduce((pathMap, route) => {
|
||||
const routeProps = route.props();
|
||||
const routeProps = route.props() as any;
|
||||
pathMap[routeProps.path] = routeProps.component;
|
||||
return pathMap;
|
||||
}, {});
|
||||
|
||||
@@ -98,7 +98,7 @@ describe("TileBar Component", () => {
|
||||
|
||||
describe("Electron", () => {
|
||||
beforeAll(() => {
|
||||
window["require"] = jest.fn(() => electronMock);
|
||||
window["require"] = jest.fn(() => electronMock) as any;
|
||||
});
|
||||
|
||||
describe("Windows", () => {
|
||||
|
||||
@@ -27,7 +27,7 @@ export class TitleBar extends React.Component<ITitleBarProps, ITitleBarState> {
|
||||
menu: null,
|
||||
};
|
||||
|
||||
private menu: Menu = React.createRef();
|
||||
private menu: Menu = React.createRef() as any;
|
||||
private remote: Electron.Remote;
|
||||
private currentWindow: Electron.BrowserWindow;
|
||||
|
||||
@@ -73,11 +73,11 @@ export class TitleBar extends React.Component<ITitleBarProps, ITitleBarState> {
|
||||
}
|
||||
{this.state.platform === PlatformType.Windows &&
|
||||
<div className="title-bar-menu">
|
||||
<Menu ref={this.menu}
|
||||
<Menu ref={this.menu as any}
|
||||
mode="horizontal"
|
||||
selectable={false}
|
||||
triggerSubMenuAction="click"
|
||||
onClick={this.onMenuItemSelected}>
|
||||
onClick={this.onMenuItemSelected as any}>
|
||||
{this.renderMenu(this.state.menu)}
|
||||
</Menu>
|
||||
</div>
|
||||
@@ -211,7 +211,7 @@ export class TitleBar extends React.Component<ITitleBarProps, ITitleBarState> {
|
||||
|
||||
private onMenuItemSelected = (key: string, item: React.Component) => {
|
||||
// Required to auto-close the menu after user selects an item.
|
||||
this.menu.current.store.setState({
|
||||
(this.menu as any).current.store.setState({
|
||||
openKeys: [],
|
||||
selectedKeys: [],
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ export const reducer = (state: IProject = null, action: AnyAction): IProject =>
|
||||
const newTags: ITag[] = state.tags ? [...state.tags] : [];
|
||||
let updateTags = false;
|
||||
|
||||
assetTags.forEach((tag) => {
|
||||
assetTags.forEach((tag: string) => {
|
||||
if (!state.tags || state.tags.length === 0 ||
|
||||
!state.tags.find((projectTag) => tag === projectTag.name)) {
|
||||
newTags.push({
|
||||
|
||||
@@ -23,7 +23,7 @@ describe("Active Learning Service", () => {
|
||||
};
|
||||
|
||||
beforeAll(() => {
|
||||
window["require"] = jest.fn(() => electronMock);
|
||||
window["require"] = jest.fn(() => electronMock) as any;
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
||||
+28
-27
@@ -1,29 +1,30 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"allowJs": false,
|
||||
"skipLibCheck": false,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "preserve",
|
||||
"experimentalDecorators": true,
|
||||
"lib": [
|
||||
"es2015",
|
||||
"dom"
|
||||
],
|
||||
"typeRoots": [
|
||||
"./typings",
|
||||
"./node_modules/@types"
|
||||
],
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": false,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react",
|
||||
"experimentalDecorators": true,
|
||||
"lib": [
|
||||
"es2015",
|
||||
"dom"
|
||||
],
|
||||
"typeRoots": [
|
||||
"./typings",
|
||||
"./node_modules/@types"
|
||||
],
|
||||
"noFallthroughCasesInSwitch": true
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"defaultSeverity": "error",
|
||||
"extends": [
|
||||
"tslint:recommended"
|
||||
],
|
||||
"jsRules": {},
|
||||
"rules": {
|
||||
"object-literal-sort-keys": false,
|
||||
"no-console": false,
|
||||
"no-shadowed-variable": false,
|
||||
"ordered-imports": false,
|
||||
"no-string-literal": false,
|
||||
"no-bitwise": false,
|
||||
"function-constructor": false
|
||||
},
|
||||
"rulesDirectory": []
|
||||
}
|
||||
Referência em uma Nova Issue
Bloquear um usuário