Skip to content

Commit

Permalink
fix: some issue
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Jul 14, 2022
1 parent 08bbc5e commit 725f65e
Show file tree
Hide file tree
Showing 12 changed files with 1,099 additions and 1,422 deletions.
2 changes: 1 addition & 1 deletion src/workbench/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@angular-cli/base-href-webpack": "1.0.16",
"@angular/animations": "14.0.3",
"@angular/cdk": "14.0.3",
"@angular/cdk": "13.3.9",
"@angular/common": "14.0.3",
"@angular/compiler": "14.0.3",
"@angular/core": "14.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class ApiDetailMockComponent implements OnInit, OnChanges {
listConf: object = {};
isVisible = false;
createWayMap = {
system: $localize `System creation`,
custom: $localize `Manual creation`,
system: $localize`System creation`,
custom: $localize`Manual creation`,
};
mockListColumns = [
{ title: $localize`Name`, key: 'name' },
Expand Down Expand Up @@ -74,7 +74,7 @@ export class ApiDetailMockComponent implements OnInit, OnChanges {
}

getApiUrl(mock?: ApiMockEntity) {
const data = eoFormatRequestData(this.apiData, { env: {} }, 'en-US');
const data = eoFormatRequestData(this.apiData, { env: {}, beforeScript: '', afterScript: '' }, 'en-US');
const uri = this.apiTest.transferUrlAndQuery(data.URL, this.apiData.queryParams, {
base: 'query',
replaceType: 'replace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ export class ApiMockComponent implements OnInit, OnChanges {
}
get modalTitle() {
return `${
this.currentEditMockIndex === -1 ? $localize`Add` : this.currentEditMock.createWay === 'system' ? $localize`Preview` : $localize`Edit`
this.currentEditMockIndex === -1
? $localize`Add`
: this.currentEditMock.createWay === 'system'
? $localize`Preview`
: $localize`Edit`
} Mock`;
}
mocklList: ApiMockEntity[] = [];
apiData: ApiData;
createWayMap = {
system: $localize `System creation`,
custom: $localize `Manual creation`,
system: $localize`System creation`,
custom: $localize`Manual creation`,
};
mockListColumns = [
{ title: $localize`Name`, slot: 'name', width: '20%' },
Expand Down Expand Up @@ -100,7 +104,7 @@ export class ApiMockComponent implements OnInit, OnChanges {
}

getApiUrl(mock?: ApiMockEntity) {
const data = eoFormatRequestData(this.apiData, { env: {} }, 'en-US');
const data = eoFormatRequestData(this.apiData, { env: {}, beforeScript: '', afterScript: '' }, 'en-US');
const uri = this.apiTest.transferUrlAndQuery(data.URL, this.apiData.queryParams, {
base: 'query',
replaceType: 'replace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ fdescribe('test unit format request/response', function () {
weight: 0,
uuid: 2,
};
let result = eoFormatRequestData(requestInfo, { env: {} }, 'en-US');
let result = eoFormatRequestData(requestInfo, { env: {}, beforeScript: '', afterScript: '' }, 'en-US');
expect(result).toEqual(
jasmine.objectContaining({
URL: 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ export const eoFormatRequestData = (data, opts = { env: {}, beforeScript: '', af
auth: { status: '0' },
advancedSetting: { requestRedirect: 1, checkSSL: 0, sendEoToken: 1, sendNocacheToken: 0 },
env: formatEnv(opts.env),
beforeScript: opts.beforeScript,
afterScript: opts.afterScript,
beforeInject: opts.beforeScript,
afterInject: opts.afterScript,
testTime: formatDate(new Date(), 'YYYY-MM-dd HH:mm:ss', locale),
};
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class TestServerAPIKitService implements TestServer {
*
* @param input
*/
formatRequestData(data, opts = { env: {} }) {
formatRequestData(data, opts = { env: {}, beforeScript: '', afterScript: '' }) {
return eoFormatRequestData(data, opts, this.locale);
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export interface TestLocalNodeData {
* execute script before test
* @type {string}
*/
beforeScript?: string;
beforeInject?: string;
/**
* execute script after response
* @type {string}
*/
afterScript?: string;
afterInject?: string;

/**
* advanced http setting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class TestServerLocalNodeService implements TestServer {
*
* @param input
*/
formatRequestData(data, opts = { env: {} }) {
formatRequestData(data, opts = { env: {}, beforeScript: '', afterScript: '' }) {
return eoFormatRequestData(data, opts, this.locale);
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class TestServerRemoteService implements TestServer {
*
* @param input
*/
formatRequestData(data, opts = { env: {} }) {
formatRequestData(data, opts = { env: {}, beforeScript: '', afterScript: '' }) {
return eoFormatRequestData(data, opts, this.locale);
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class TestServerServerlessService implements TestServer {
*
* @param input
*/
formatRequestData(data, opts = { env: {} }) {
formatRequestData(data, opts = { env: {}, beforeScript: '', afterScript: '' }) {
return eoFormatRequestData(data, opts, this.locale);
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Environment, ApiTestHistoryFrame } from '../storage/index.model';
export interface TestServer {
init: (receiveMessage: (message: any) => void) => void;
send: (action: string, message: any) => void;
formatRequestData: (apiData, opts: { env: Environment }) => any;
formatRequestData: (apiData, opts: { env: Environment; beforeScript: string; afterScript: string }) => any;
formatResponseData: (res) => { report: any; history: ApiTestHistoryFrame };
close: () => void;
}
Loading

0 comments on commit 725f65e

Please sign in to comment.