-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
1,648 additions
and
1,641 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
'use strict' | ||
import { expect, jest, describe, it } from '@jest/globals' | ||
|
||
import { MetadataRepository } from '../../../../src/metadata/MetadataRepository' | ||
import CustomLabelHandler from '../../../../src/service/customLabelHandler' | ||
import type { Work } from '../../../../src/types/work' | ||
import { getGlobalMetadata, getWork } from '../../../__utils__/globalTestHelper' | ||
|
||
const labelType = { | ||
directoryName: 'labels', | ||
inFolder: false, | ||
metaFile: false, | ||
parentXmlName: 'CustomLabels', | ||
xmlName: 'CustomLabel', | ||
childXmlNames: ['CustomLabel'], | ||
suffix: 'labels', | ||
xmlTag: 'labels', | ||
key: 'fullName', | ||
} | ||
|
||
let globalMetadata: MetadataRepository | ||
beforeAll(async () => { | ||
globalMetadata = await getGlobalMetadata() | ||
}) | ||
let work: Work | ||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
work = getWork() | ||
}) | ||
|
||
describe('Decomposed CustomLabel spec', () => { | ||
const line = 'force-app/main/default/labels/Test.label-meta.xml' | ||
describe('when file is added', () => { | ||
let sut: CustomLabelHandler | ||
beforeEach(() => { | ||
// Arrange | ||
sut = new CustomLabelHandler(line, labelType, work, globalMetadata) | ||
}) | ||
it('should add the element in the package', async () => { | ||
// Arrange | ||
|
||
// Act | ||
await sut.handleAddition() | ||
|
||
// Assert | ||
expect(work.diffs.destructiveChanges.size).toEqual(0) | ||
expect(work.diffs.package.get('CustomLabel')).toEqual(new Set(['Test'])) | ||
}) | ||
}) | ||
|
||
describe('when file is modified', () => { | ||
let sut: CustomLabelHandler | ||
beforeEach(() => { | ||
// Arrange | ||
sut = new CustomLabelHandler(line, labelType, work, globalMetadata) | ||
}) | ||
it('should add the element in the package', async () => { | ||
// Arrange | ||
|
||
// Act | ||
await sut.handleModification() | ||
|
||
// Assert | ||
expect(work.diffs.destructiveChanges.size).toEqual(0) | ||
expect(work.diffs.package.get('CustomLabel')).toEqual(new Set(['Test'])) | ||
}) | ||
}) | ||
|
||
describe('when file is deleted', () => { | ||
let sut: CustomLabelHandler | ||
beforeEach(() => { | ||
// Arrange | ||
sut = new CustomLabelHandler(line, labelType, work, globalMetadata) | ||
}) | ||
it('should add the element in the destructiveChanges', async () => { | ||
// Arrange | ||
|
||
// Act | ||
await sut.handleDeletion() | ||
|
||
// Assert | ||
expect(work.diffs.package.size).toEqual(0) | ||
expect(work.diffs.destructiveChanges.get('CustomLabel')).toEqual( | ||
new Set(['Test']) | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.