-
-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Properly handle logs created and saved through createLogger*( in pre-…
…mounted instances (#577) * Fixed #518 by calling saveLog() as soon as createLogger() has finished loading for pending log messages
- Loading branch information
1 parent
77fe275
commit b140e72
Showing
9 changed files
with
121 additions
and
31 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
45 changes: 45 additions & 0 deletions
45
nebula-logger/recipes/lwc/loggerLWCDemo/__tests__/loggerLWCDemo.test.js
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,45 @@ | ||
import { createElement } from 'lwc'; | ||
import LoggerLWCDemo from 'c/loggerLWCDemo'; | ||
|
||
import getSettings from '@salesforce/apex/ComponentLogger.getSettings'; | ||
|
||
const flushPromises = async () => { | ||
await new Promise(process.nextTick); | ||
}; | ||
|
||
const MOCK_GET_SETTINGS = { | ||
defaultSaveMethod: 'EVENT_BUS', | ||
isEnabled: true, | ||
isConsoleLoggingEnabled: true, | ||
supportedLoggingLevels: { FINEST: 2, FINER: 3, FINE: 4, DEBUG: 5, INFO: 6, WARN: 7, ERROR: 8 }, | ||
userLoggingLevel: { ordinal: 2, name: 'FINEST' } | ||
}; | ||
|
||
jest.mock( | ||
'@salesforce/apex/ComponentLogger.getSettings', | ||
() => { | ||
return { | ||
default: jest.fn() | ||
}; | ||
}, | ||
{ virtual: true } | ||
); | ||
|
||
describe('logger demo tests', () => { | ||
afterEach(() => { | ||
while (document.body.firstChild) { | ||
document.body.removeChild(document.body.firstChild); | ||
} | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('mounts and saves log correctly in one go', async () => { | ||
getSettings.mockResolvedValue({ ...MOCK_GET_SETTINGS }); | ||
const demo = createElement('c-logger-demo', { is: LoggerLWCDemo }); | ||
document.body.appendChild(demo); | ||
|
||
await flushPromises(); | ||
|
||
expect(demo.logger?.getBufferSize()).toBe(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
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 |
---|---|---|
|
@@ -13,9 +13,9 @@ | |
"package": "Nebula Logger - Core", | ||
"path": "./nebula-logger/core", | ||
"definitionFile": "./config/scratch-orgs/base-scratch-def.json", | ||
"versionNumber": "4.11.11.NEXT", | ||
"versionName": "Reduced Usage of Email Limits Consumption in LoggerEmailSender", | ||
"versionDescription": "Updated LoggerEmailSender to use the instance method Messaging.SingleEmailMessage.setTargetObjectId() when sending failure emails to internal users, which does not count towards the transactional email limits", | ||
"versionNumber": "4.11.12.NEXT", | ||
"versionName": "Bugfix for Lightning Component Entries Not Always Saving", | ||
"versionDescription": "Fixed an issue in the logger LWC where log entries in lightning components would be lost while trying to load LoggerSettings__c for the current user", | ||
"releaseNotesUrl": "https://github.com/jongpie/NebulaLogger/releases", | ||
"unpackagedMetadata": { | ||
"path": "./nebula-logger/extra-tests" | ||
|
@@ -159,6 +159,7 @@ | |
"Nebula Logger - [email protected]__c.loggedbyusernametext__c-and-logentry__c.loggedbyusernametext__c": "04t5Y000001OigJQAS", | ||
"Nebula Logger - [email protected]": "04t5Y000001OigxQAC", | ||
"Nebula Logger - Core@4.11.11-reduced-usage-of-email-limits-consumption-in-loggeremailsender": "04t5Y000001Oih7QAC", | ||
"Nebula Logger - Core@4.11.12-bugfix-for-lightning-component-entries-not-always-saving": "04t5Y000001Mjx5QAC", | ||
"Nebula Logger - Core Plugin - Async Failure Additions": "0Ho5Y000000blO4SAI", | ||
"Nebula Logger - Core Plugin - Async Failure [email protected]": "04t5Y0000015lhiQAA", | ||
"Nebula Logger - Core Plugin - Async Failure [email protected]": "04t5Y0000015lhsQAA", | ||
|