diff --git a/fission/src/test/mirabuf/MirabufParser.test.ts b/fission/src/test/MirabufParser.test.ts similarity index 94% rename from fission/src/test/mirabuf/MirabufParser.test.ts rename to fission/src/test/MirabufParser.test.ts index 274e89362f..93a0b3b2d7 100644 --- a/fission/src/test/mirabuf/MirabufParser.test.ts +++ b/fission/src/test/MirabufParser.test.ts @@ -1,8 +1,8 @@ import { describe, test, expect } from "vitest"; -import { mirabuf } from "../../proto/mirabuf"; -import MirabufParser, { RigidNodeReadOnly } from "../../mirabuf/MirabufParser"; -import { LoadMirabufLocal } from "../../mirabuf/MirabufLoader"; +import { mirabuf } from "../proto/mirabuf"; +import MirabufParser, { RigidNodeReadOnly } from "../mirabuf/MirabufParser"; +import { LoadMirabufLocal } from "../mirabuf/MirabufLoader"; describe('Mirabuf Parser Tests', () => { // test('Get Dozer JSON', () => { diff --git a/fission/src/test/PhysicsSystem.test.ts b/fission/src/test/PhysicsSystem.test.ts index b3c09f5bdc..2665ae56a5 100644 --- a/fission/src/test/PhysicsSystem.test.ts +++ b/fission/src/test/PhysicsSystem.test.ts @@ -1,7 +1,9 @@ import { test, expect, describe, assert } from 'vitest'; import PhysicsSystem from '../systems/physics/PhysicsSystem'; +import { LoadMirabufLocal } from '@/mirabuf/MirabufLoader'; +import MirabufParser from '@/mirabuf/MirabufParser'; -describe('Physics System Tests', () => { +describe('Physics Sansity Checks', () => { test('Convex Hull Shape (Cube)', () => { const points: Float32Array = new Float32Array( [ @@ -60,4 +62,24 @@ describe('Physics System Tests', () => { shape.Release(); system.Destroy(); }); +}); + +describe('Mirabuf Body Loading', () => { + test('Body Loading (Dozer)', () => { + const assembly = LoadMirabufLocal('./public/test_mira/Dozer_v2.mira'); + const parser = new MirabufParser(assembly); + const physSystem = new PhysicsSystem(); + const mapping = physSystem.CreateBodiesFromParser(parser); + + expect(mapping.size).toBe(7); + }); + + test('Body Loading (Team_2471_(2018)_v7.mira)', () => { + const assembly = LoadMirabufLocal('./public/test_mira/Team_2471_(2018)_v7.mira'); + const parser = new MirabufParser(assembly); + const physSystem = new PhysicsSystem(); + const mapping = physSystem.CreateBodiesFromParser(parser); + + expect(mapping.size).toBe(10); + }); }); \ No newline at end of file diff --git a/fission/src/test/World.test.ts b/fission/src/test/World.test.ts new file mode 100644 index 0000000000..2ffb335834 --- /dev/null +++ b/fission/src/test/World.test.ts @@ -0,0 +1,19 @@ +import World from "@/systems/World"; +import { describe, test, expect, beforeEach, vi } from "vitest"; + +describe('World Tests', () => { + + beforeEach(() => { + vi.resetAllMocks(); + }); + + test('World Sanity Check', () => { + expect(World.isAlive).toBeFalsy(); + + // TODO: Find a way to mock window global + // World.InitWorld(); + // expect(World.isAlive).toBeTruthy(); + // expect(World.SceneRenderer).toBeTruthy(); + // expect(World.DestroyWorld).toBeTruthy(); + }); +}) \ No newline at end of file