提交 04ca6594 编写于 作者: fxy060608's avatar fxy060608

feat(mp): mock internal instance as mp instance #3002

上级 c18efec7
...@@ -205,7 +205,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -205,7 +205,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -267,7 +267,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -267,7 +267,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -131,7 +131,7 @@ export function initMocks( ...@@ -131,7 +131,7 @@ export function initMocks(
const ctx = (instance as any).ctx const ctx = (instance as any).ctx
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock] ;(instance as any)[mock] = ctx[mock] = mpInstance[mock]
} }
}) })
} }
......
...@@ -262,7 +262,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -262,7 +262,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -130,7 +130,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -130,7 +130,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) { ...@@ -258,7 +258,7 @@ function initMocks(instance, mpInstance, mocks) {
const ctx = instance.ctx; const ctx = instance.ctx;
mocks.forEach((mock) => { mocks.forEach((mock) => {
if (hasOwn(mpInstance, mock)) { if (hasOwn(mpInstance, mock)) {
ctx[mock] = mpInstance[mock]; instance[mock] = ctx[mock] = mpInstance[mock];
} }
}); });
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册