Skip to content

Commit 2e6cf2b

Browse files
committed
test: added snapshot tests
1 parent f60b078 commit 2e6cf2b

File tree

8 files changed

+17
-26
lines changed

8 files changed

+17
-26
lines changed

src/resolve/metadataResolver.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,13 @@ const resolveDirectoryAsComponent =
225225
(registry: RegistryAccess) =>
226226
(tree: TreeContainer) =>
227227
(dirPath: string): boolean => {
228+
// For web_app bundles, only the bundle directory itself should be resolved as a component
229+
// (e.g., digitalExperiences/web_app/WebApp), not subdirectories like src/, public/, etc.
228230
if (isWebAppBaseType(dirPath)) {
229-
return true;
231+
const pathParts = dirPath.split(sep);
232+
const digitalExperiencesIndex = pathParts.indexOf('digitalExperiences');
233+
// The bundle directory is exactly 3 levels deep: digitalExperiences/web_app/bundleName
234+
return digitalExperiencesIndex !== -1 && pathParts.length === digitalExperiencesIndex + 3;
230235
}
231236

232237
const type = resolveType(registry)(tree)(dirPath);

test/snapshot/sampleProjects/digitalExperienceBundleWithWebapps/__snapshots__/verify-md-files.expected/digitalExperiences/web_app/WebApp/public/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta name="theme-color" content="#000000" />
7-
<meta
8-
name="description"
9-
content="Web App 2 - React Application"
10-
/>
7+
<meta name="description" content="Web App 2 - React Application" />
118
<title>WebApp2</title>
129
</head>
1310
<body>

test/snapshot/sampleProjects/digitalExperienceBundleWithWebapps/__snapshots__/verify-md-files.expected/digitalExperiences/web_app/WebApp/src/App.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ function App() {
66
<div className="App">
77
<header className="App-header">
88
<h1>Welcome to WebApp2</h1>
9-
<p>
10-
This is a dummy React application.
11-
</p>
9+
<p>This is a dummy React application.</p>
1210
<div className="card">
1311
<h2>Getting Started</h2>
1412
<p>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
body {
22
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5-
sans-serif;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
4+
'Droid Sans', 'Helvetica Neue', sans-serif;
65
-webkit-font-smoothing: antialiased;
76
-moz-osx-font-smoothing: grayscale;
87
}
98

109
code {
11-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12-
monospace;
10+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
1311
}

test/snapshot/sampleProjects/digitalExperienceBundleWithWebapps/__snapshots__/verify-md-files.expected/package.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
33
<types>
4-
<members>web_app/</members>
4+
<members>web_app/WebApp</members>
55
<name>DigitalExperienceBundle</name>
66
</types>
77
<version>64.0</version>

test/snapshot/sampleProjects/digitalExperienceBundleWithWebapps/__snapshots__/verify-source-files.expected/force-app/main/default/digitalExperiences/web_app/WebApp/public/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
<meta charset="utf-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1" />
66
<meta name="theme-color" content="#000000" />
7-
<meta
8-
name="description"
9-
content="Web App 2 - React Application"
10-
/>
7+
<meta name="description" content="Web App 2 - React Application" />
118
<title>WebApp2</title>
129
</head>
1310
<body>

test/snapshot/sampleProjects/digitalExperienceBundleWithWebapps/__snapshots__/verify-source-files.expected/force-app/main/default/digitalExperiences/web_app/WebApp/src/App.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ function App() {
66
<div className="App">
77
<header className="App-header">
88
<h1>Welcome to WebApp2</h1>
9-
<p>
10-
This is a dummy React application.
11-
</p>
9+
<p>This is a dummy React application.</p>
1210
<div className="card">
1311
<h2>Getting Started</h2>
1412
<p>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
body {
22
margin: 0;
3-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5-
sans-serif;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans',
4+
'Droid Sans', 'Helvetica Neue', sans-serif;
65
-webkit-font-smoothing: antialiased;
76
-moz-osx-font-smoothing: grayscale;
87
}
98

109
code {
11-
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12-
monospace;
10+
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', monospace;
1311
}

0 commit comments

Comments
 (0)