Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#12588] Improve test code coverage of LogsDetails #12618

Closed

Conversation

nikkixiong
Copy link

Fixes #12588

Outline of Solution

Added tests to LogsDetails

@cedricongjh cedricongjh self-requested a review October 22, 2023 19:10
@cedricongjh cedricongjh self-assigned this Oct 22, 2023
@cedricongjh cedricongjh added the s.ToReview The PR is waiting for review(s) label Oct 22, 2023
@cedricongjh
Copy link
Contributor

hi @nikkixiong, do fix the lint issues before we proceed to review this PR, you can check if there are lint issues locally by running npm run lint

@nikkixiong
Copy link
Author

hi @cedricongjh , I already fixed the lint issues and ready to be reviewed.

Copy link
Contributor

@cedricongjh cedricongjh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your PR, i've a few comments!

expect(component.details).toEqual(log.details);
});

// Test for Branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: lets remove these comments (before each it and describe), the strings are sufficient in describing what the test is for

Comment on lines +49 to +68
it('should not set details when log details event is not EMAIL_SENT', () => {
const log: GeneralLogEntry = {
severity: LogSeverity.DEFAULT,
trace: 'test_trace',
insertId: '1',
resourceIdentifier: { id: '2' },
sourceLocation: { file: 'log.txt', line: 42, function: 'test_function' },
timestamp: Date.now(),
message: 'test_message',
details: {
event: LogEvent.EXCEPTION_LOG,
message: 'email_sent',
},
};

component.log = log;

expect(component.logValue).toEqual(log);
expect(component.details).toBeUndefined();
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's also add a test for checking these lines:

this.emailContent = details.emailContent;
details.emailContent = undefined;
this.details = details;

check that if there's email content, its set to undefined in details, and that the this.emailContent contains the email content

exceptionDetails.exceptionMessages = ['message'];

component.log = { ...log, details: exceptionDetails };
expect(component.exceptionStackTrace).toContain(': message');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be better here if we expect the exceptionStackTrace to equal to a whole string, to make it clear how the string should look like

@@ -22,4 +22,105 @@ describe('RequestLogDetailsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});

it('should set log and details when input is provided', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a test for when details.requestBody is truthy and check for requestBody as well as details.requestBody

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 8 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 7 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 11 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 9 days). 🐌 😢
Hope someone can get it to move forward again soon...

@cedricongjh
Copy link
Contributor

hi @nikkixiong, wondering if you're still working on this PR? there are some comments that are still unaddressed

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 13 days). 🐌 😢
Hope someone can get it to move forward again soon...

@nusoss-bot
Copy link

Folks, This PR seems to be stalling (no activities for the past 16 days). 🐌 😢
Hope someone can get it to move forward again soon...

@cedricongjh
Copy link
Contributor

hi @nikkixiong, we'll be closing this PR, do reopen it if you are still working on it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s.ToReview The PR is waiting for review(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve test code coverage of core components
3 participants