Skip to content

Commit

Permalink
Revert "fix: detection of CustomMetadata type (scolladon#844)"
Browse files Browse the repository at this point in the history
This reverts commit 412592b.
  • Loading branch information
a-ursu committed May 24, 2024
1 parent 73d24ce commit 8441f1a
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 118 deletions.
28 changes: 1 addition & 27 deletions __tests__/unit/lib/metadata/MetadataRepositoryImpl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ describe('MetadataRepositoryImpl', () => {
suffix: 'app',
xmlName: 'CustomApplication',
},
{
directoryName: 'customMetadata',
inFolder: false,
metaFile: false,
suffix: 'md',
xmlName: 'CustomMetadata',
},
{
directoryName: 'documents',
inFolder: true,
Expand Down Expand Up @@ -235,17 +228,6 @@ describe('MetadataRepositoryImpl', () => {
})

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

// Assert
expect(result).toStrictEqual(
expect.objectContaining({ directoryName: 'customMetadata' })
)
})
it('matches `xml` files inside `emailservices` folder', () => {
// Act
const result = sut.get('force-app/emailservices/testService.xml')
Expand Down Expand Up @@ -364,7 +346,7 @@ describe('MetadataRepositoryImpl', () => {
expect(result).toBeUndefined()
})

it('does not match `app` files outside `applications` folder', () => {
it('matches on folder', () => {
// Act
const result = sut.get(
'Z force-app/main/folder/aura/TestApp/TestApp.app'
Expand All @@ -375,14 +357,6 @@ describe('MetadataRepositoryImpl', () => {
expect.objectContaining({ directoryName: 'aura' })
)
})

it('does not match `md` files outside `customMetadata` folder', () => {
// Act
const result = sut.get('README.md')

// Assert
expect(result).toBeUndefined()
})
})
})

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"author": "Sebastien Colladon <[email protected]>",
"dependencies": {
"@salesforce/command": "^5.3.9",
"@salesforce/core": "^7.3.1",
"@salesforce/core": "^7.3.0",
"async": "^3.2.5",
"fast-xml-parser": "^4.3.6",
"fs-extra": "^11.2.0",
Expand Down Expand Up @@ -177,7 +177,7 @@
"@commitlint/config-conventional": "^19.2.2",
"@jest/globals": "^29.7.0",
"@oclif/dev-cli": "^1.26.10",
"@salesforce/cli-plugins-testkit": "^5.2.3",
"@salesforce/cli-plugins-testkit": "^5.2.1",
"@salesforce/dev-config": "^4.1.0",
"@salesforce/ts-sinon": "^1.4.19",
"@stryker-mutator/core": "^8.2.6",
Expand All @@ -187,8 +187,8 @@
"@types/jest": "^29.5.12",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.7",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@typescript-eslint/eslint-plugin": "^7.7.0",
"@typescript-eslint/parser": "^7.7.0",
"benchmark": "^2.1.4",
"chai": "^4.3.10",
"eslint": "^8.57.0",
Expand Down
3 changes: 1 addition & 2 deletions src/constant/metadataConstants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict'
export const CUSTOM_APPLICATION_SUFFIX = 'app'
export const CUSTOM_METADATA_SUFFIX = 'md'
export const EMAIL_SERVICES_FUNCTION_SUFFIX = 'xml'
export const EMAILSERVICESFUNCTION_SUFFIX = 'xml'
export const FIELD_DIRECTORY_NAME = 'fields'
export const FLOW_XML_NAME = 'Flow'
export const INFOLDER_SUFFIX = `Folder`
Expand Down
6 changes: 2 additions & 4 deletions src/metadata/MetadataRepositoryImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { parse } from 'path'
import { DOT, PATH_SEP } from '../constant/fsConstants'
import {
CUSTOM_APPLICATION_SUFFIX,
CUSTOM_METADATA_SUFFIX,
EMAIL_SERVICES_FUNCTION_SUFFIX,
EMAILSERVICESFUNCTION_SUFFIX,
METAFILE_SUFFIX,
OBJECT_TRANSLATION_TYPE,
OBJECT_TYPE,
Expand Down Expand Up @@ -130,8 +129,7 @@ export class MetadataRepositoryImpl implements MetadataRepository {

private static UNSAFE_EXTENSION = new Set([
CUSTOM_APPLICATION_SUFFIX,
EMAIL_SERVICES_FUNCTION_SUFFIX,
CUSTOM_METADATA_SUFFIX,
EMAILSERVICESFUNCTION_SUFFIX,
])

private static COMPOSED_TYPES = new Set([
Expand Down
Loading

0 comments on commit 8441f1a

Please sign in to comment.