diff --git a/packages/vest/src/suite/__tests__/staticSuite.test.ts b/packages/vest/src/suite/__tests__/staticSuite.test.ts index 29bf919ee..972b8fc8b 100644 --- a/packages/vest/src/suite/__tests__/staticSuite.test.ts +++ b/packages/vest/src/suite/__tests__/staticSuite.test.ts @@ -1,8 +1,8 @@ -import { SuiteSerializer } from 'SuiteSerializer'; -import { VestIsolateType } from 'VestIsolateType'; import { describe, it, expect } from 'vitest'; import wait from 'wait'; +import { SuiteSerializer } from 'SuiteSerializer'; +import { VestIsolateType } from 'VestIsolateType'; import * as vest from 'vest'; import { staticSuite } from 'vest'; @@ -172,4 +172,15 @@ describe('runStatic', () => { expect(result.dump()).toHaveProperty('$type', VestIsolateType.Suite); }); }); + describe('When creating the suite with a name', () => { + it("Should set the suite's name", () => { + const suite = vest.create('user_form', () => { + vest.test('t1', () => false); + }); + + const res = suite.runStatic(); + + expect(res.suiteName).toBe('user_form'); + }); + }); }); diff --git a/packages/vest/src/suite/createSuite.ts b/packages/vest/src/suite/createSuite.ts index 06b381b1f..202027f96 100644 --- a/packages/vest/src/suite/createSuite.ts +++ b/packages/vest/src/suite/createSuite.ts @@ -1,4 +1,4 @@ -import { assign, CB } from 'vest-utils'; +import { asArray, assign, CB } from 'vest-utils'; import { Bus, VestRuntime } from 'vestjs-runtime'; import { TTypedMethods, getTypedMethods } from './getTypedMethods'; @@ -40,7 +40,7 @@ function createSuite< >( ...args: [suiteName: SuiteName, suiteCallback: T] | [suiteCallback: T] ): Suite { - const [suiteCallback, suiteName] = args.reverse() as [T, SuiteName]; + const [suiteCallback, suiteName] = asArray(args).reverse() as [T, SuiteName]; validateSuiteCallback(suiteCallback);