Merge branch 'gt38-add-version-schema'

This commit is contained in:
Yanick Champoux 2023-04-16 14:06:20 -04:00
commit c466631f27
7 changed files with 153 additions and 43 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,99 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`state has the expected shape 1`] = `
{
"carrier": {
"nbrBays": 0,
"reqs": {
"cost": 0,
"mass": 0,
},
"squadrons": [],
},
"identification": {
"isCarrier": false,
"reqs": {
"cost": 0,
"mass": 10,
"usedMass": 0,
},
"shipClass": "",
"shipType": "",
},
"propulsion": {
"drive": {
"advanced": false,
"rating": 0,
"reqs": {
"cost": 0,
"mass": 0,
},
},
"ftl": {
"reqs": {
"cost": 0,
"mass": 0,
},
"type": "none",
},
},
"schemaVersion": "1",
"structure": {
"armor": {
"layers": [],
"reqs": {
"cost": 0,
"mass": 0,
},
},
"cargo": {
"reqs": {
"cost": 0,
"mass": 0,
},
"space": 0,
},
"hull": {
"max": 0,
"min": 0,
"rating": 0,
"reqs": {
"cost": 0,
"mass": 0,
},
},
"screens": {
"advanced": 0,
"reqs": {
"cost": 0,
"mass": 0,
},
"standard": 0,
},
"streamlining": {
"reqs": {
"cost": 0,
"mass": 0,
},
"type": "none",
},
},
"weaponry": {
"adfc": {
"rating": 0,
"reqs": {
"cost": 0,
"mass": 0,
},
},
"firecons": {
"reqs": {
"cost": 0,
"mass": 0,
},
"stations": 0,
},
"weapons": [],
},
}
`;

View File

@ -59,3 +59,11 @@ test("kicking the tires", () => {
},
});
});
test("state has a schema version", () => {
expect(ship.initialState).toHaveProperty("schemaVersion");
});
test("state has the expected shape", () => {
expect(ship.initialState).toMatchSnapshot();
});

View File

@ -51,6 +51,9 @@ const weaponry = new Updux({
});
const shipDux = new Updux({
initialState: {
schemaVersion: "1",
},
subduxes: {
identification,
structure,