integration tests
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m51s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
Some checks failed
CI / lint-typecheck (pull_request) Failing after 4m51s
CI / tests (pull_request) Has been skipped
CI / contract-tests (pull_request) Has been skipped
CI / e2e-tests (pull_request) Has been skipped
CI / comment-pr (pull_request) Has been skipped
CI / commit-types (pull_request) Has been skipped
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* Integration Test: DataFactory
|
||||
*
|
||||
* Tests the DataFactory infrastructure for creating test data
|
||||
*/
|
||||
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { setupHarnessTest } from '../HarnessTestContext';
|
||||
|
||||
describe('DataFactory - Infrastructure Tests', () => {
|
||||
const context = setupHarnessTest();
|
||||
|
||||
describe('Entity Creation', () => {
|
||||
it('should create a league entity', async () => {
|
||||
const league = await context.factory.createLeague({
|
||||
name: 'Test League',
|
||||
description: 'Test Description',
|
||||
});
|
||||
|
||||
expect(league).toBeDefined();
|
||||
expect(league.name).toBe('Test League');
|
||||
});
|
||||
|
||||
it('should create a season entity', async () => {
|
||||
const league = await context.factory.createLeague();
|
||||
const season = await context.factory.createSeason(league.id.toString(), {
|
||||
name: 'Test Season',
|
||||
});
|
||||
|
||||
expect(season).toBeDefined();
|
||||
expect(season.leagueId).toBe(league.id.toString());
|
||||
expect(season.name).toBe('Test Season');
|
||||
});
|
||||
|
||||
it('should create a driver entity', async () => {
|
||||
const driver = await context.factory.createDriver({
|
||||
name: 'Test Driver',
|
||||
});
|
||||
|
||||
expect(driver).toBeDefined();
|
||||
expect(driver.name.toString()).toBe('Test Driver');
|
||||
});
|
||||
|
||||
it('should create a race entity', async () => {
|
||||
const league = await context.factory.createLeague();
|
||||
const race = await context.factory.createRace({
|
||||
leagueId: league.id.toString(),
|
||||
track: 'Laguna Seca',
|
||||
});
|
||||
|
||||
expect(race).toBeDefined();
|
||||
expect(race.track).toBe('Laguna Seca');
|
||||
});
|
||||
|
||||
it('should create a result entity', async () => {
|
||||
const league = await context.factory.createLeague();
|
||||
const race = await context.factory.createRace({ leagueId: league.id.toString() });
|
||||
const driver = await context.factory.createDriver();
|
||||
|
||||
const result = await context.factory.createResult(race.id.toString(), driver.id.toString(), {
|
||||
position: 1,
|
||||
});
|
||||
|
||||
expect(result).toBeDefined();
|
||||
expect(result.position).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Scenarios', () => {
|
||||
it('should create a complete test scenario', async () => {
|
||||
const scenario = await context.factory.createTestScenario();
|
||||
|
||||
expect(scenario.league).toBeDefined();
|
||||
expect(scenario.season).toBeDefined();
|
||||
expect(scenario.drivers).toHaveLength(3);
|
||||
expect(scenario.races).toHaveLength(2);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user