Skip to content

Commit

Permalink
Changed from deep search to deterministic path query.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfdctaka committed Nov 10, 2023
1 parent 2cd295d commit 7c614d4
Show file tree
Hide file tree
Showing 7 changed files with 1,125 additions and 127 deletions.
47 changes: 41 additions & 6 deletions src/test/suite/commands/wizard/lwcGenerationCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ suite('LWC Generation Command Test Suite', () => {
const fsAccess = sinon.stub(fs, 'access');
fsAccess.returns();
const invalidJsonFile = 'landing_page.json';
const invalidJsonContents = 'invalid_json_here';
fs.writeFileSync(invalidJsonFile, invalidJsonContents, 'utf8');
const invalidJsonContent = 'invalid_json_here';
fs.writeFileSync(invalidJsonFile, invalidJsonContent, 'utf8');

const status = await LwcGenerationCommand.getSObjectsFromLandingPage();

Expand All @@ -121,10 +121,45 @@ suite('LWC Generation Command Test Suite', () => {
const fsAccess = sinon.stub(fs, 'access');
fsAccess.returns();
const validJsonFile = 'landing_page.json';
const jsonContents =
'{ "definition": "mcf/list", "properties": { "objectApiName": "Account" }, "nested": { "definition": "mcf/timedList", "properties": { "objectApiName": "Contact"} } }';
fs.writeFileSync(validJsonFile, jsonContents, 'utf8');

const jsonContent = {
view: {
regions: {
components: {
components: [
{
regions: {
components: {
components: [
{
definition: 'mcf/list',
properties: {
objectApiName: 'Account'
}
}
]
}
}
},
{
regions: {
components: {
components: [
{
definition: 'mcf/list',
properties: {
objectApiName: 'Contact'
}
}
]
}
}
}
]
}
}
}
};
fs.writeFileSync(validJsonFile, JSON.stringify(jsonContent), 'utf8');
const status = await LwcGenerationCommand.getSObjectsFromLandingPage();

assert.equal(status.sobjects.length, 2);
Expand Down
228 changes: 228 additions & 0 deletions src/test/suite/utils/data/landing_page_case_management.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"view": {
"definition": "generated/landing_page",
"name": "component_view",
"properties": {},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/container",
"name": "container",
"properties": {
"backgroundColor": "#F3F2f2"
},
"dataProviders": {},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/card",
"name": "global_actions",
"properties": {
"label": "Global Actions"
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcfp/actionList",
"name": "actions_list",
"properties": {},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcfp/actionItem",
"name": "global_action",
"properties": {
"apiName": "Global.New_Case_Report"
},
"regions": {}
}
]
}
}
}
]
}
}
},
{
"definition": "mcf/card",
"name": "recent_cases",
"properties": {
"label": "Recent Cases"
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/list",
"name": "case_list",
"properties": {
"size": 5,
"objectApiName": "Case",
"fieldMap": {
"mainField": "Subject",
"subField1": "Status"
},
"fields": {
"Subject": "StringValue",
"Status": "StringValue"
},
"orderBy": [
{
"LastViewedDate": "DESC"
}
]
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/recordRow",
"name": "record_row",
"properties": {},
"regions": {}
}
]
}
}
}
]
}
}
},
{
"definition": "mcf/card",
"name": "recent_accounts",
"properties": {
"label": "Recent Accounts"
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/list",
"name": "account_list",
"properties": {
"size": 5,
"objectApiName": "Account",
"fieldMap": {
"mainField": "Name",
"subField1": "AnnualRevenue",
"subField2": "Industry"
},
"fields": {
"Name": "StringValue",
"AnnualRevenue": "StringValue",
"Industry": "StringValue"
},
"orderBy": [
{
"LastViewedDate": "DESC"
}
]
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/recordRow",
"name": "record_row",
"properties": {},
"regions": {}
}
]
}
}
}
]
}
}
},
{
"definition": "mcf/card",
"name": "recent_contacts",
"properties": {
"label": "Recent Contacts"
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/list",
"name": "contact_list",
"properties": {
"size": 5,
"objectApiName": "Contact",
"fieldMap": {
"mainField": "Name",
"subField1": "Title"
},
"fields": {
"Name": "StringValue",
"Title": "StringValue",
"MobilePhone": "StringValue",
"Email": "StringValue"
},
"orderBy": [
{
"LastViewedDate": "DESC"
}
],
"swipeActions": {
"call": [
{
"label": "Mobile",
"value": "MobilePhone"
}
],
"email": [
{
"label": "Email",
"value": "Email"
}
]
}
},
"regions": {
"components": {
"name": "components",
"components": [
{
"definition": "mcf/recordRow",
"name": "record_row",
"properties": {},
"regions": {}
}
]
}
}
}
]
}
}
}
]
}
}
}
]
}
}
},
"target": "mcf__native",
"apiName": "landing_page",
"id": "8592e04f-f59b-4a19-9b1f-af7d55f2b491"
}
Loading

0 comments on commit 7c614d4

Please sign in to comment.