Skip to content

Commit

Permalink
style: linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gas1cent committed Jan 12, 2024
1 parent a1f2902 commit d626d9f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
24 changes: 9 additions & 15 deletions test/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -341,18 +341,14 @@ describe('Parser', () => {
const node = contract.vStateVariables.find(({ name }) => name === 'SOME_CONSTANT')!;
const result = parser.parseNodeNatspec(node);

expect(result).toEqual(
mockNatspec({})
);
expect(result).toEqual(mockNatspec({}));
});

it('should not parse regular comments as natspec', async () => {
const node = contract.vFunctions.find(({ name }) => name === 'viewFunctionWithParams')!;
const result = parser.parseNodeNatspec(node);

expect(result).toEqual(
mockNatspec({})
);
expect(result).toEqual(mockNatspec({}));
});

it('should parse natspec with multiple spaces', async () => {
Expand All @@ -365,20 +361,20 @@ describe('Parser', () => {
{
name: 'notice',
content: 'Some private stuff',
}
},
],
params: [
{
name: '_paramName',
content: 'The parameter name',
}
},
],
returns: [
{
name: '_returned',
content: 'The returned value',
}
]
},
],
})
);
});
Expand All @@ -387,9 +383,7 @@ describe('Parser', () => {
const node = contract.vFunctions.find(({ name }) => name === '_viewInternal')!;
const result = parser.parseNodeNatspec(node);

expect(result).toEqual(
mockNatspec({})
);
expect(result).toEqual(mockNatspec({}));
});

it('should parse block natspec with invalid formatting', async () => {
Expand Down Expand Up @@ -421,8 +415,8 @@ describe('Parser', () => {
},
{
name: 'dev',
content: 'What have I done'
}
content: 'What have I done',
},
],
})
);
Expand Down
16 changes: 8 additions & 8 deletions test/processor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,24 @@ describe('Processor', () => {
const nodeName = faker.lorem.word();

const sourceUnit = mockSourceUnit({
absolutePath: absolutePath
absolutePath: absolutePath,
});

const contract = mockContractDefinition({
name: contractName
name: contractName,
});

it('should format the location of the node', () => {
const node = mockNodeToProcess({
name: nodeName
name: nodeName,
});

expect(processor.formatLocation(node, sourceUnit, contract)).toEqual(`${absolutePath}\n${contractName}:${nodeName}`);
});

it('should format the location of a constructor', () => {
const node = mockFunctionDefinition({
kind: FunctionKind.Constructor
kind: FunctionKind.Constructor,
});

expect(processor.formatLocation(node, sourceUnit, contract)).toEqual(`${absolutePath}\n${contractName}:constructor`);
Expand Down Expand Up @@ -112,17 +112,17 @@ describe('Processor', () => {

it('should not select using directives', () => {
const eligibleNodes = processor.selectEligibleNodes(contract);
expect(eligibleNodes.some((node) => node instanceof UsingForDirective )).toBeFalsy();
expect(eligibleNodes.some((node) => node instanceof UsingForDirective)).toBeFalsy();
});

it('should not select user defined value types', () => {
const eligibleNodes = processor.selectEligibleNodes(contract);
expect(eligibleNodes.some((node) => node instanceof UserDefinedType )).toBeFalsy();
expect(eligibleNodes.some((node) => node instanceof UserDefinedType)).toBeFalsy();
});

it('should select the constructor only once', () => {
const eligibleNodes = processor.selectEligibleNodes(contract);
expect(eligibleNodes.filter((node) => node instanceof FunctionDefinition && node.isConstructor ).length).toEqual(1);
expect(eligibleNodes.filter((node) => node instanceof FunctionDefinition && node.isConstructor).length).toEqual(1);
});
});
});

0 comments on commit d626d9f

Please sign in to comment.