feat: add isOptional to methods as well (#84) · buehler/node-typescript-parser@e550f7c

@@ -395,7 +395,7 @@ describe('TypescriptParser', () => {

395395

});

396396397397

it('should parse a file', () => {

398-

expect(parsed.declarations).toHaveLength(4);

398+

expect(parsed.declarations).toHaveLength(6);

399399

});

400400401401

it('should parse a non exported interface', () => {

@@ -436,6 +436,18 @@ describe('TypescriptParser', () => {

436436

expect(parsedInterface.typeParameters).toContain('TError');

437437

});

438438439+

it('should parse optional properties', () => {

440+

const parsedInterface = parsed.declarations[4] as InterfaceDeclaration;

441+442+

expect(parsedInterface.properties).toMatchSnapshot();

443+

});

444+445+

it('should parse optional functions', () => {

446+

const parsedInterface = parsed.declarations[5] as InterfaceDeclaration;

447+448+

expect(parsedInterface).toMatchSnapshot();

449+

});

450+439451

});

440452441453

describe('Classes', () => {

@@ -448,7 +460,7 @@ describe('TypescriptParser', () => {

448460

});

449461450462

it('should parse a file', () => {

451-

expect(parsed.declarations).toHaveLength(8);

463+

expect(parsed.declarations).toHaveLength(9);

452464

});

453465454466

it('should parse an abstract class', () => {

@@ -529,6 +541,12 @@ describe('TypescriptParser', () => {

529541

expect(parsedClass.ctor).toMatchSnapshot();

530542

});

531543544+

it('should parse optional class properties', () => {

545+

const parsedClass = parsed.declarations[8] as ClassDeclaration;

546+547+

expect(parsedClass.properties).toMatchSnapshot();

548+

});

549+532550

});

533551534552

describe('Modules', () => {