UNPKG

testeranto

Version:

the AI powered BDD test framework for typescript projects

105 lines (97 loc) 2.94 kB
import { ITestSpecification } from "../../CoreTypes"; import { I, O } from "./classBuilder.test.types"; import { implementation } from "./classBuilder.test.implementation"; export const specification: ITestSpecification<I, O> = ( Suite, Given, When, Then ) => { return [ Suite.Default("Basic ClassBuilder Functionality", { // Basic initialization tests initialization: Given.Default( ["ClassBuilder should initialize with default values"], [], [Then.initializedProperly()] ), customInput: Given.WithCustomInput( { custom: "input" }, [], [Then.initializedProperly()] ), resourceRequirements: Given.WithResourceRequirements( { ports: [3000, 3001] }, [], [Then.resourceRequirementsSet()] ), // Core functionality tests specGeneration: Given.Default( ["Should generate specs from test specification"], [], [Then.specsGenerated()] ), jobCreation: Given.Default( ["Should create test jobs from specs"], [], [Then.jobsCreated()] ), artifactTracking: Given.Default( ["Should track artifacts"], [When.addArtifact(Promise.resolve("test"))], [Then.artifactsTracked()] ), // Configuration tests overridesConfiguration: Given.Default( ["Should properly configure all overrides"], [], [ Then.suitesOverridesConfigured(), Then.givensOverridesConfigured(), Then.whensOverridesConfigured(), Then.thensOverridesConfigured(), ] ), }), Suite.ExtendedSuite( "Advanced ClassBuilder Functionality", { // Custom implementations customImplementation: Given.WithCustomImplementation( implementation, [], [Then.specsGenerated(), Then.jobsCreated()] ), customSpecification: Given.WithCustomSpecification( specification, [], [Then.specsGenerated(), Then.jobsCreated()] ), // Dynamic modification tests modifySpecs: Given.Default( ["Should allow modifying specs"], [When.modifySpecs((specs) => [...specs, "extra"])], [Then.specsModified(1)] ), modifyJobs: Given.Default( ["Should allow modifying jobs"], [When.modifyJobs((jobs) => [...jobs, {} as ITestJob])], [Then.jobsModified(1)] ), // Error handling errorHandling: Given.Default( ["Should properly handle errors"], [When.triggerError("test error")], [Then.errorThrown("test error")] ), // Full test run testRun: Given.Default( ["Should complete a full test run successfully"], [], [Then.testRunSuccessful()] ), }, [] ), ]; };