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

refactor: remove need for CurrentParser state #515

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions log-viewer/modules/__tests__/ApexLogParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Copyright (c) 2020 Certinia Inc. All rights reserved.
*/
import {
ApexLogParser,
CodeUnitStartedLine,
ExecutionStartedLine,
LogLine,
Expand Down Expand Up @@ -1081,7 +1082,8 @@ describe('namespace tests', () => {

describe('Recalculate durations tests', () => {
it('Recalculates parent node', () => {
const node = new Method(['14:32:07.563 (1)', 'DUMMY'], [], 'Method', '');
const parser = new ApexLogParser();
const node = new Method(parser, ['14:32:07.563 (1)', 'DUMMY'], [], 'Method', '');
node.exitStamp = 3;

node.recalculateDurations();
Expand All @@ -1092,8 +1094,9 @@ describe('Recalculate durations tests', () => {

describe('Line Type Tests', () => {
it('Lines referenced by exitTypes should be exits', () => {
const parser = new ApexLogParser();
for (const [key, lineType] of lineTypeMap) {
const line = new lineType([
const line = new lineType(parser, [
'14:32:07.563 (17358806534)',
'DUMMY',
'[10]',
Expand All @@ -1110,7 +1113,7 @@ describe('Line Type Tests', () => {
const exitCls = lineTypeMap.get(exitType);
expect(exitCls).not.toBe(null);
if (exitCls) {
const exitLine = new exitCls!([
const exitLine = new exitCls!(parser, [
'14:32:07.563 (17358806534)',
'DUMMY',
'[10]',
Expand All @@ -1126,7 +1129,8 @@ describe('Line Type Tests', () => {
});

it('SOQL Explain null when no plan available ', () => {
const qp = new SOQLExecuteExplainLine([
const parser = new ApexLogParser();
const qp = new SOQLExecuteExplainLine(parser, [
'6:22:36.91 (2106345473)',
'SOQL_EXECUTE_EXPLAIN',
'[19]',
Expand Down
4 changes: 3 additions & 1 deletion log-viewer/modules/__tests__/soql/SOQLLinter.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* Copyright (c) 2021 Certinia Inc. All rights reserved.
*/
import { Method } from '../../parsers/ApexLogParser.js';
import { ApexLogParser, Method } from '../../parsers/ApexLogParser.js';
import { SOQLLinter } from '../../soql/SOQLLinter.js';

describe('SOQL Linter rule tests', () => {
Expand Down Expand Up @@ -153,8 +153,10 @@ describe('SOQL in Trigger Rule tests', () => {
};

it('soql in trigger should return rule', async () => {
const parser = new ApexLogParser();
const soql = 'SELECT Id FROM AnObject__c WHERE value__c > 0';
const mockTriggerLine = new Method(
parser,
[
'04:16:39.166 (1166781977)',
'CODE_UNIT_STARTED',
Expand Down
Loading
Loading