Skip to content

Commit

Permalink
Revert "fix: metadata type detection on file extension (scolladon#835)"
Browse files Browse the repository at this point in the history
This reverts commit 181d8c6.
  • Loading branch information
a-ursu committed May 24, 2024
1 parent a8c575c commit 2ebbf1b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 99 deletions.
54 changes: 26 additions & 28 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": "0.2",
"words": [
"\u00c0gain",
"afile",
"Afile",
"amannn",
"anotherignore",
"apexskier",
Expand All @@ -25,15 +25,15 @@
"behaviour",
"benchmarkjs",
"brqh",
"cherfaoui",
"Cherfaoui",
"codeclimate",
"codecov",
"codecov",
"codeowners",
"colladon",
"CODECOV",
"CODEOWNERS",
"Colladon",
"commandsstop",
"commitlint",
"commitlint",
"Commitlint",
"contentassets",
"customindex",
"datacategorygroup",
Expand All @@ -43,31 +43,30 @@
"destructiveignore",
"destructiveinclude",
"emailservices",
"emailservicesfunction",
"EMAILSERVICESFUNCTION",
"eslintcache",
"experiencebundle",
"firstsha",
"flexi",
"Flexi",
"flexipage",
"flexipages",
"flowtest",
"flowtests",
"flowtype",
"forceignore",
"forceignore",
"forceinclude",
"FORCEIGNORE",
"forceinclude",
"FORCEINCLUDE",
"friendlyname",
"fullname",
"FULLNAME",
"geodata",
"gitdir",
"hardlinks",
"iframe",
"iframe",
"Iframe",
"ignorewarnings",
"iife",
"indx",
"infile",
"Infile",
"knip",
"lcov",
"linebreak",
Expand All @@ -76,10 +75,10 @@
"lwcc",
"mdapi",
"megalinter",
"mehdi",
"Mehdi",
"mehdisfdc",
"metafile",
"metafile",
"METAFILE",
"mjyhjbm",
"mkdirs",
"mocharc",
Expand All @@ -88,7 +87,7 @@
"mutingpermissionset",
"mutingpermissionsets",
"myexperiencebundle",
"nimn",
"Nimn",
"nonblock",
"notblank",
"notexist",
Expand All @@ -100,10 +99,10 @@
"oauthcustomscopes",
"oclif",
"omni",
"omni",
"Omni",
"omnistudio",
"oxsecurity",
"parens",
"Parens",
"pastsha",
"permissionset",
"permissionsetgroup",
Expand All @@ -122,18 +121,17 @@
"samlssoconfig",
"samlssoconfigs",
"scolladon",
"scontrol",
"Scontrol",
"scontrols",
"sebastien",
"sfdx",
"sfdx",
"Sebastien",
"sfdx",
"Sfdx",
"SFDX",
"sgdignore",
"sgdinclude",
"sgdincludedestructive",
"shellcheck",
"sitedotcom",
"staticresource",
"STATICRESOURCE",
"staticresources",
"stefanzweifel",
"struc",
Expand All @@ -142,17 +140,17 @@
"testkit",
"testlevel",
"testtest",
"translationline",
"Translationline",
"trivyignore",
"tsbuildinfo",
"unmanaged",
"unmocked",
"unpackaged",
"unpackaged",
"Unpackaged",
"venv",
"wagoid",
"wapp",
"wavehandler",
"Wavehandler",
"wcomp",
"wdash",
"wdpr",
Expand Down
70 changes: 8 additions & 62 deletions __tests__/unit/lib/metadata/MetadataRepositoryImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,27 +104,6 @@ describe('MetadataRepositoryImpl', () => {
suffix: 'xml',
xmlName: 'EmailServicesFunction',
},
{
directoryName: 'sites',
inFolder: false,
metaFile: false,
suffix: 'site',
xmlName: 'CustomSite',
},
{
directoryName: 'siteDotComSites',
inFolder: false,
metaFile: true,
suffix: 'site',
xmlName: 'SiteDotCom',
},
{
directoryName: 'experiences',
inFolder: false,
metaFile: true,
suffix: 'site',
xmlName: 'ExperienceBundle',
},
])
})
describe('has', () => {
Expand Down Expand Up @@ -227,47 +206,14 @@ describe('MetadataRepositoryImpl', () => {
)
})

describe('special cases where it should only match on folder', () => {
it('matches `xml` files inside `emailservices` folder', () => {
// Act
const result = sut.get('force-app/emailservices/testService.xml')

// Assert
expect(result).toStrictEqual(
expect.objectContaining({ directoryName: 'emailservices' })
)
})
it('should match `Site`', () => {
// Act
const result = sut.get('Z force-app/main/default/sites/aSite.site')

// Assert
expect(result).toStrictEqual(
expect.objectContaining({ directoryName: 'sites' })
)
})
it('should match `SiteDotCom`', () => {
// Act
const result = sut.get(
'Z force-app/main/default/siteDotComSites/aSitedotcom.site'
)

// Assert
expect(result).toStrictEqual(
expect.objectContaining({ directoryName: 'siteDotComSites' })
)
})
it('should match `ExperienceBundle`', () => {
// Act
const result = sut.get(
'Z force-app/main/default/experiences/aCommunity.site'
)

// Assert
expect(result).toStrictEqual(
expect.objectContaining({ directoryName: 'experiences' })
)
})
it('matches `xml` files inside `emailservices` folder', () => {
// Act
const result = sut.get('force-app/emailservices/testService.xml')

// Assert
expect(result).toStrictEqual(
expect.objectContaining({ directoryName: 'emailservices' })
)
})
})

Expand Down
3 changes: 0 additions & 3 deletions src/constant/metadataConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

export const CUSTOM_APPLICATION_TYPE = 'applications'
export const EMAILSERVICESFUNCTION_SUFFIX = 'emailservices'
export const EXPERIENCEBUNDLE_FOLDER = 'experiences'
export const FIELD_DIRECTORY_NAME = 'fields'
export const FLOW_XML_NAME = 'Flow'
export const INFOLDER_SUFFIX = `Folder`
Expand All @@ -17,8 +16,6 @@ export const OBJECT_TRANSLATION_META_XML_SUFFIX = `objectTranslation${METAFILE_S
export const OBJECT_TYPE = 'objects'
export const OBJECT_XML_NAME = 'CustomObject'
export const RESTRICTION_RULE_TYPE = 'restrictionRules'
export const SITE_FOLDER = 'sites'
export const SITEDOTCOM_FOLDER = 'siteDotComSites'
export const SUB_OBJECT_TYPES = [
'businessProcesses',
'compactLayouts',
Expand Down
6 changes: 0 additions & 6 deletions src/metadata/MetadataRepositoryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,10 @@ import { DOT, PATH_SEP } from '../constant/fsConstants'
import {
CUSTOM_APPLICATION_TYPE,
EMAILSERVICESFUNCTION_SUFFIX,
EXPERIENCEBUNDLE_FOLDER,
METAFILE_SUFFIX,
OBJECT_TRANSLATION_TYPE,
OBJECT_TYPE,
RESTRICTION_RULE_TYPE,
SITEDOTCOM_FOLDER,
SITE_FOLDER,
SUB_OBJECT_TYPES,
TERRITORY_MODEL_TYPE,
} from '../constant/metadataConstants'
Expand Down Expand Up @@ -106,9 +103,6 @@ export class MetadataRepositoryImpl implements MetadataRepository {
CUSTOM_APPLICATION_TYPE,
RESTRICTION_RULE_TYPE,
EMAILSERVICESFUNCTION_SUFFIX,
SITE_FOLDER,
SITEDOTCOM_FOLDER,
EXPERIENCEBUNDLE_FOLDER,
]

private static COMPOSED_TYPES = [
Expand Down

0 comments on commit 2ebbf1b

Please sign in to comment.