diff --git a/src/MissionControl.Data/MissionControlContext.cs b/src/MissionControl.Data/MissionControlContext.cs index c5637e0..ed77394 100644 --- a/src/MissionControl.Data/MissionControlContext.cs +++ b/src/MissionControl.Data/MissionControlContext.cs @@ -11,7 +11,8 @@ public class MissionControlContext(DbContextOptions optio protected override void OnModelCreating(ModelBuilder modelBuilder) { - modelBuilder.Entity() + modelBuilder + .Entity() .HasMany(mission => mission.MissionLaunches) .WithOne(missionLaunch => missionLaunch.Mission) .HasForeignKey(missionLaunch => missionLaunch.MissionId) diff --git a/src/MissionControl.Server/Endpoints/Missions/Contract.cs b/src/MissionControl.Server/Endpoints/Missions/Contract.cs index 5c6b830..0f07462 100644 --- a/src/MissionControl.Server/Endpoints/Missions/Contract.cs +++ b/src/MissionControl.Server/Endpoints/Missions/Contract.cs @@ -25,6 +25,8 @@ public record MissionResponse Description = mission.Description, Status = mission.Status, CreatedAt = mission.CreatedAt, - MissionLaunches = mission.MissionLaunches.Select(MissionLaunchResponse.FromDomain).ToList(), + MissionLaunches = mission + .MissionLaunches.Select(MissionLaunchResponse.FromDomain) + .ToList(), }; } diff --git a/src/MissionControl.Server/Endpoints/Missions/ListMissions.cs b/src/MissionControl.Server/Endpoints/Missions/ListMissions.cs index b85d5e4..329ece3 100644 --- a/src/MissionControl.Server/Endpoints/Missions/ListMissions.cs +++ b/src/MissionControl.Server/Endpoints/Missions/ListMissions.cs @@ -14,8 +14,8 @@ public class ListMissions(MissionControlContext dbContext) public override async Task HandleAsync(CancellationToken ct) { - var missions = await dbContext.Missions - .AsNoTracking() + var missions = await dbContext + .Missions.AsNoTracking() .Include(m => m.MissionLaunches.OrderByDescending(l => l.ScheduledFor)) .OrderByDescending(m => m.CreatedAt) .ToListAsync(ct); diff --git a/src/MissionControl.Server/Endpoints/Missions/MissionLaunches/CreateMissionLaunch.cs b/src/MissionControl.Server/Endpoints/Missions/MissionLaunches/CreateMissionLaunch.cs index 701d0a8..823fe8d 100644 --- a/src/MissionControl.Server/Endpoints/Missions/MissionLaunches/CreateMissionLaunch.cs +++ b/src/MissionControl.Server/Endpoints/Missions/MissionLaunches/CreateMissionLaunch.cs @@ -16,7 +16,10 @@ public class CreateMissionLaunch(MissionControlContext dbContext) public override async Task HandleAsync(CreateMissionLaunchRequest req, CancellationToken ct) { - var missionExists = await dbContext.Missions.AnyAsync(mission => mission.Id == req.MissionId, ct); + var missionExists = await dbContext.Missions.AnyAsync( + mission => mission.Id == req.MissionId, + ct + ); if (!missionExists) { await Send.NotFoundAsync(ct); diff --git a/src/mission-control-client/src/components/MissionsTable/MissionsTable.test.tsx b/src/mission-control-client/src/components/MissionsTable/MissionsTable.test.tsx index 57150ef..6fe5335 100644 --- a/src/mission-control-client/src/components/MissionsTable/MissionsTable.test.tsx +++ b/src/mission-control-client/src/components/MissionsTable/MissionsTable.test.tsx @@ -1,30 +1,32 @@ import { MantineProvider } from '@mantine/core'; import { render, screen } from '@testing-library/react'; import { describe, expect, it } from 'vitest'; +import type { MissionLaunch } from '../../api/missionLaunches'; import type { Mission } from '../../api/missions'; import { MissionsTable } from './MissionsTable'; -import type { MissionLaunch } from '../../api/missionLaunches'; function missionLaunches(): MissionLaunch[] { -return [{ - id: 'launch id', - scheduledFor: '2026-07-07T13:56:00+00:00', - status: 'Pending', - createdAt: '2026-07-07T13:56:00+00:00', -}]; + return [ + { + id: 'launch id', + scheduledFor: '2026-07-07T13:56:00+00:00', + status: 'Pending', + createdAt: '2026-07-07T13:56:00+00:00', + }, + ]; } function getMockMissions(withLaunches = false): Mission[] { return [ - { - id: 'a mission id', - name: 'mission name is here!', - description: null, - status: 'Planned', - createdAt: '', - missionLaunches: withLaunches ? missionLaunches() : [], - }, -]; + { + id: 'a mission id', + name: 'mission name is here!', + description: null, + status: 'Planned', + createdAt: '', + missionLaunches: withLaunches ? missionLaunches() : [], + }, + ]; } describe('MissionsTable', () => { @@ -60,9 +62,7 @@ describe('MissionsTable', () => { screen.getAllByTestId('row-expand')[0].click(); expect( - screen.queryByText( - 'No launches have been created for this mission yet!', - ), + screen.queryByText('No launches have been created for this mission yet!'), ).toBeInTheDocument(); }); @@ -76,9 +76,7 @@ describe('MissionsTable', () => { screen.getAllByTestId('row-expand')[0].click(); expect( - screen.queryByText( - 'No launches have been created for this mission yet!', - ), + screen.queryByText('No launches have been created for this mission yet!'), ).toBeNull(); }); diff --git a/src/mission-control-client/src/utils/dateUtils.test.ts b/src/mission-control-client/src/utils/dateUtils.test.ts index b7a13be..f20519a 100644 --- a/src/mission-control-client/src/utils/dateUtils.test.ts +++ b/src/mission-control-client/src/utils/dateUtils.test.ts @@ -1,5 +1,5 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; -import { toReadableDateTime } from "./dateUtils"; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { toReadableDateTime } from './dateUtils'; beforeEach(() => { vi.stubEnv('TZ', 'UTC'); @@ -14,13 +14,13 @@ describe('dateUtils', () => { it('returns invalid date when datetime passed is in incorrect format', () => { const date = toReadableDateTime('invalid'); - expect(date).toBe("Invalid Date"); + expect(date).toBe('Invalid Date'); }); - it ('returns readable date when datetime passed is in valid format', () => { + it('returns readable date when datetime passed is in valid format', () => { const date = toReadableDateTime('2026-07-27T23:27:22.1976394+00:00'); expect(date).toBe('27/07/2026, 23:27:22'); }); }); -}); \ No newline at end of file +}); diff --git a/test/MissionControl.Server.Tests/Endpoints/Missions/MissionLaunches/CreateMissionLaunchTests.cs b/test/MissionControl.Server.Tests/Endpoints/Missions/MissionLaunches/CreateMissionLaunchTests.cs index eaa1daf..7be69c9 100644 --- a/test/MissionControl.Server.Tests/Endpoints/Missions/MissionLaunches/CreateMissionLaunchTests.cs +++ b/test/MissionControl.Server.Tests/Endpoints/Missions/MissionLaunches/CreateMissionLaunchTests.cs @@ -30,14 +30,18 @@ public class CreateMissionLaunchTests { var validator = new CreateMissionLaunchRequestValidator(); - var result = validator.Validate(new CreateMissionLaunchRequest - { - MissionId = Guid.Empty, - ScheduledFor = default, - Status = MissionLaunchStatus.Pending, - }); + var result = validator.Validate( + new CreateMissionLaunchRequest + { + MissionId = Guid.Empty, + ScheduledFor = default, + Status = MissionLaunchStatus.Pending, + } + ); result.IsValid.ShouldBeFalse(); - result.Errors.ShouldContain(e => e.PropertyName == nameof(CreateMissionLaunchRequest.MissionId)); + result.Errors.ShouldContain(e => + e.PropertyName == nameof(CreateMissionLaunchRequest.MissionId) + ); } }