From 7a4fa8161fe01ab77182cd5d640938bec03c1fc8 Mon Sep 17 00:00:00 2001 From: Antoine Boisier-Michaud Date: Fri, 14 Dec 2018 21:14:12 -0500 Subject: [PATCH] Added implicit names test --- .../decorators/testDecorator/testDecorator.spec.ts | 14 ++++++++++---- .../decorators/testDecorator/testWithoutNames.ts | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/spec/decorators/testDecorator/testDecorator.spec.ts b/src/spec/decorators/testDecorator/testDecorator.spec.ts index b916cd6..0ead13a 100644 --- a/src/spec/decorators/testDecorator/testDecorator.spec.ts +++ b/src/spec/decorators/testDecorator/testDecorator.spec.ts @@ -10,6 +10,7 @@ import { Report } from '../../../lib/reporting/report/report'; import { TestsRunnerVisitor } from '../../../lib/tests/visitors/runnerVisitor'; import { TestSuite } from '../../../lib/tests/testSuite'; import { SingleTestTestDecoratorTestSuite } from './singleTestTestDecoratorTestSuite'; +import { FailedTestsReportVisitor } from '../../../lib/tests/visitors/failedTestsReportVisitor'; @testSuite('Test Decorator Test Suite') export class TestDecoratorTestSuite { @@ -77,12 +78,17 @@ export class TestDecoratorTestSuite { @test('no names, should infer from method names') private async noNameTest() { // Arrange - const testSuite = (TestWithNoNamesTestSuite as any).__testSuiteInstance; - - // Act - const report = testSuite.accept(this.visitor); + const testSuite = this.getTestSuiteInstance(TestWithNoNamesTestSuite); // Assert + expect.toBeIn('myTest1', testSuite.testIds); + expect.toBeIn('myTest2', testSuite.testIds); + expect.toBeIn('myTest3', testSuite.testIds); + + const myTest3 = testSuite.get('myTest3') as TestSuite; + expect.toBeIn('myTestCase1', myTest3.testIds); + expect.toBeIn('myTestCase2', myTest3.testIds); + expect.toBeIn('myTestCase3', myTest3.testIds); } protected getTestSuiteInstance(testClass: any): TestSuite { diff --git a/src/spec/decorators/testDecorator/testWithoutNames.ts b/src/spec/decorators/testDecorator/testWithoutNames.ts index 5093a33..62b3937 100644 --- a/src/spec/decorators/testDecorator/testWithoutNames.ts +++ b/src/spec/decorators/testDecorator/testWithoutNames.ts @@ -11,9 +11,9 @@ export class TestWithNoNamesTestSuite { private myTest2() { } @test(undefined, [ - new TestCase('testCase1'), - new TestCase('testCase2'), - new TestCase('testCase3') + new TestCase('myTestCase1'), + new TestCase('myTestCase2'), + new TestCase('myTestCase3') ]) private myTest3() { } } \ No newline at end of file