Skip to content

Commit

Permalink
test: add spec for detection via extension
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Jun 13, 2024
1 parent f4c8850 commit 5df216c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions __tests__/unit/lib/service/inResourceHandler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,34 @@ describe('InResourceHandler', () => {
})
})
})

describe('when outside its folder', () => {
it('should match via the extension', async () => {
// Arrange
const metadataElement = `MarketingUser`
const path = `force-app/main/default/wrongFolder/${metadataElement}.permissionset-meta.xml`
const line = `A ${path}`

const sut = new InResourceHandler(
line,
permissionSetType,
work,
globalMetadata
)
mockedReadDir.mockResolvedValueOnce([])

// Act
await sut.handle()

// Assert
expect(
Array.from(work.diffs.package.get(permissionSetType.xmlName)!)
).toEqual([metadataElement])
expect(copyFiles).toBeCalledTimes(3)
expect(copyFiles).toHaveBeenCalledWith(work.config, path)
expect(copyFiles).toHaveBeenCalledWith(work.config, path)
})
})
})

describe('When entity is deleted', () => {
Expand Down

0 comments on commit 5df216c

Please sign in to comment.