-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #468 from auth0/DXCDT-84-resource-exclusion
DXCDT-84: Resource Exclusion
- Loading branch information
Showing
8 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
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,34 @@ | ||
import { expect } from 'chai'; | ||
import Auth0 from '../../../src/tools/auth0' | ||
import { Auth0APIClient, Assets } from '../../../src/types' | ||
|
||
const mockEmptyClient = {} as Auth0APIClient | ||
const mockEmptyAssets = {} as Assets | ||
|
||
describe("#Auth0 class", () => { | ||
|
||
describe("#resource exclusion", () => { | ||
it('should exclude handlers listed in AUTH0_EXCLUDED from Auth0 class', () => { | ||
|
||
const auth0WithoutExclusions = new Auth0(mockEmptyClient, mockEmptyAssets, () => []); | ||
|
||
const AUTH0_EXCLUDED = ['rules', 'organizations', 'connections'] | ||
const auth0WithExclusions = new Auth0(mockEmptyClient, mockEmptyAssets, () => AUTH0_EXCLUDED); | ||
|
||
expect(auth0WithoutExclusions.handlers.length).to.equal(auth0WithExclusions.handlers.length + AUTH0_EXCLUDED.length) // Number of handlers is reduced by number of exclusions | ||
|
||
const areAllExcludedHandlersAbsent = auth0WithExclusions.handlers.some((handler) => { | ||
return AUTH0_EXCLUDED.includes(handler.type) | ||
}) | ||
|
||
expect(areAllExcludedHandlersAbsent).to.be.false; | ||
}) | ||
|
||
it('should not exclude any handlers if AUTH0_EXCLUDED is undefined', () => { | ||
const AUTH0_EXCLUDED = undefined | ||
const auth0 = new Auth0(mockEmptyClient, mockEmptyAssets, () => AUTH0_EXCLUDED); | ||
|
||
expect(auth0.handlers.length).to.be.greaterThan(0) | ||
}) | ||
}) | ||
}) |
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