Skip to content

Commit

Permalink
Revert "fix: automock apex methods with valid wire adapters (#208)"
Browse files Browse the repository at this point in the history
This reverts commit 125c689.
  • Loading branch information
jodarove committed Jun 29, 2021
1 parent af09f58 commit 12d2bc8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"overrides": [
{
"files": ["src/lightning-stubs/**", "src/apex-stubs/**"],
"files": ["src/lightning-stubs/**"],
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
Expand Down
9 changes: 0 additions & 9 deletions src/apex-stubs/method/method.js

This file was deleted.

22 changes: 3 additions & 19 deletions src/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,36 +47,20 @@ function resolveAsFile(name, extensions) {
return undefined;
}

function getModuleMock(modulePath, moduleName) {
const p = path.join(__dirname, modulePath, moduleName);
function getLightningMock(modulePath) {
const p = path.join(__dirname, 'lightning-stubs', modulePath);
if (fs.existsSync(p)) {
return path.join(p, moduleName + '.js');
return path.join(p, modulePath + '.js');
}
}

function getLightningMock(moduleName) {
return getModuleMock('lightning-stubs', moduleName);
}

function getApexMock(moduleName) {
return getModuleMock('apex-stubs', moduleName);
}

function getModule(modulePath, options) {
const { ns, name } = getInfoFromId(modulePath);

if (ns === 'lightning') {
return getLightningMock(name);
}

// See https://developer.salesforce.com/docs/component-library/documentation/en/lwc/reference_salesforce_modules
if (
modulePath.startsWith('@salesforce/apex/') ||
modulePath.startsWith('@salesforce/apexContinuation/')
) {
return getApexMock('method');
}

if (ns === DEFAULT_NAMESPACE) {
const paths = getModulePaths();
for (let i = 0; i < paths.length; i++) {
Expand Down

0 comments on commit 12d2bc8

Please sign in to comment.