mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-07-18 20:44:48 -04:00
@@ -59,7 +59,7 @@ import { mockStorage } from './system_storage'
|
||||
import { mockRdb } from './ohos_data_rdb'
|
||||
import { mockPreferences } from './ohos_data_preferences'
|
||||
import { mockDataShare } from './ohos_data_dataShare'
|
||||
import { DataSharePredicates } from './ohos_data_dataSharePredicates'
|
||||
import { mockDataSharePredicates } from './ohos_data_dataSharePredicates'
|
||||
import { DataShareResultSet } from './ohos_data_DataShareResultSet'
|
||||
import { mockInputDevice } from './ohos_multimodalInput_inputDevice'
|
||||
import { mockVibrator } from './ohos_vibrator'
|
||||
@@ -358,8 +358,8 @@ export function mockRequireNapiFun() {
|
||||
return mockPreferences();
|
||||
case "data.dataShare":
|
||||
return mockDataShare();
|
||||
case "data.DataSharePredicates":
|
||||
return DataSharePredicates();
|
||||
case "data.dataSharePredicates":
|
||||
return mockDataSharePredicates();
|
||||
case "data.DataShareResultSet":
|
||||
return DataShareResultSet();
|
||||
case "data.dataAbility":
|
||||
|
||||
+80
-41
@@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
import { ExtensionContextClass } from "./application/abilityContext"
|
||||
import { ExtensionContextClass } from "./application/AbilityContext"
|
||||
import { DataShareResultSetMock } from "./ohos_data_DataShareResultSet"
|
||||
|
||||
export function mockDataShareExtensionAbility() {
|
||||
@@ -23,56 +23,95 @@ export function mockDataShareExtensionAbility() {
|
||||
console.warn('application.DataShareExtensionAbility interface mocked in the Previewer. How this interface works on' +
|
||||
' the Previewer may be different from that on a real device.');
|
||||
this.context = new ExtensionContextClass();
|
||||
this.onCreate = function () {
|
||||
this.onCreate = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.onCreate interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
};
|
||||
this.getFileTypes = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock)
|
||||
}
|
||||
},
|
||||
this.getFileTypes = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.getFileTypes interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return [paramMock.paramStringMock];
|
||||
};
|
||||
this.insert = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock,[paramMock.paramStringMock])
|
||||
}
|
||||
},
|
||||
this.openFile = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.openFile interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
|
||||
}
|
||||
},
|
||||
this.insert = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.insert interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
};
|
||||
this.update = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
|
||||
}
|
||||
},
|
||||
this.update = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.update interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
};
|
||||
this.delete = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
|
||||
}
|
||||
},
|
||||
this.delete = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.delete interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
};
|
||||
this.query = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
|
||||
}
|
||||
},
|
||||
this.query = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.query interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return DataShareResultSetMock;
|
||||
};
|
||||
this.getType = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock)
|
||||
}
|
||||
},
|
||||
this.getType = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.getType interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
};
|
||||
this.batchInsert = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramStringMock)
|
||||
}
|
||||
},
|
||||
this.batchInsert = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.batchInsert interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramNumberMock;
|
||||
};
|
||||
this.normalizeUri = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock, paramMock.paramNumberMock)
|
||||
}
|
||||
},
|
||||
this.normalizeUri = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.normalizeUri interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
};
|
||||
this.denormalizeUri = function () {
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock)
|
||||
}
|
||||
},
|
||||
this.denormalizeUri = function (...args) {
|
||||
console.warn("application.DataShareExtensionAbility.denormalizeUri interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
return paramMock.paramStringMock;
|
||||
};
|
||||
" may be different from that on a real device.")
|
||||
const len = args.length
|
||||
if (typeof args[len - 1] === 'function') {
|
||||
args[len - 1].call(this, paramMock.businessErrorMock)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new DataShareExtensionAbilityClass();
|
||||
return DataShareExtensionAbilityClass;
|
||||
}
|
||||
|
||||
@@ -20,10 +20,6 @@ export const DataShareResultSetMock = {
|
||||
columnCount: "[PC Preview] unknow columnCount",
|
||||
rowCount: "[PC Preview] unknow rowCount",
|
||||
rowIndex: "[PC Preview] unknow rowIndex",
|
||||
goToFirstRow: "[PC Preview] unknow goToFirstRow",
|
||||
goToLastRow: "[PC Preview] unknow goToLastRow",
|
||||
goToNextRow: "[PC Preview] unknow goToNextRow",
|
||||
goToPreviousRow: "[PC Preview] unknow goToPreviousRow",
|
||||
isEnded: "[PC Preview] unknow isEnded",
|
||||
isStarted: "[PC Preview] unknow isStarted",
|
||||
isClosed: "[PC Preview] unknow isClosed",
|
||||
@@ -98,7 +94,7 @@ export const DataShareResultSetMock = {
|
||||
return paramMock.paramNumberMock;
|
||||
},
|
||||
close: function () {
|
||||
console.warn("ResultSet.isColumnNull interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
console.warn("ResultSet.close interface mocked in the Previewer. How this interface works on the Previewer" +
|
||||
" may be different from that on a real device.")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
*/
|
||||
|
||||
import { paramMock } from "../utils"
|
||||
export function DataSharePredicates() {
|
||||
const DataSharePredicatesClass = class data_DataSharePredicates {
|
||||
export function mockDataSharePredicates() {
|
||||
const DataSharePredicatesClass = class DataSharePredicate {
|
||||
constructor() {
|
||||
this.equalTo = function (...args) {
|
||||
console.warn("DataSharePredicates.equalTo interface mocked in the Previewer. How this interface works on the" +
|
||||
|
||||
Reference in New Issue
Block a user