-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: allow to instantly refresh permissions when they change (#1008)
- Loading branch information
Showing
8 changed files
with
126 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
const { makeLogger } = require('../../src/context/build-services'); | ||
|
||
describe('context > build-services', () => { | ||
describe('makeLogger', () => { | ||
it('should create logger with default value (log level Info)', async () => { | ||
const env = {}; | ||
const logger = { | ||
info: jest.fn(), | ||
}; | ||
|
||
const internalLogger = makeLogger({ env, logger }); | ||
|
||
internalLogger('Info', 'Message'); | ||
|
||
expect(logger.info).toHaveBeenCalledOnce(); | ||
expect(logger.info).toHaveBeenCalledWith('Message'); | ||
}); | ||
|
||
describe('when FOREST_LOGGER_LEVEL is equal or higher than the actual log level', () => { | ||
it('should log the message', async () => { | ||
const env = { FOREST_LOGGER_LEVEL: 'Debug' }; | ||
const logger = { | ||
debug: jest.fn(), | ||
}; | ||
|
||
const internalLogger = makeLogger({ env, logger }); | ||
|
||
internalLogger('Debug', 'Message'); | ||
|
||
expect(logger.debug).toHaveBeenCalledOnce(); | ||
expect(logger.debug).toHaveBeenCalledWith('Message'); | ||
}); | ||
}); | ||
|
||
describe('when FOREST_LOGGER_LEVEL is lower than the actual log level', () => { | ||
it('should not log anything', async () => { | ||
const env = { FOREST_LOGGER_LEVEL: 'Error' }; | ||
const logger = { | ||
info: jest.fn(), | ||
}; | ||
|
||
const internalLogger = makeLogger({ env, logger }); | ||
|
||
internalLogger('Info', 'Message'); | ||
|
||
expect(logger.info).not.toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); | ||
}); |
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