Merge branch 'integrate'
This commit is contained in:
commit
b9fbcf8c30
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ package-lock.json
|
||||
node_modules/
|
||||
dist/yarn-error.log
|
||||
.task/
|
||||
.histoire/dist
|
||||
|
28
Taskfile.yml
28
Taskfile.yml
@ -6,6 +6,34 @@ vars:
|
||||
GREETING: Hello, World!
|
||||
|
||||
tasks:
|
||||
test:
|
||||
cmds:
|
||||
- vitest run src
|
||||
test:dev:
|
||||
cmds:
|
||||
- vitest src
|
||||
|
||||
check:
|
||||
deps:
|
||||
- histoire:build
|
||||
cmds:
|
||||
- { task: test }
|
||||
|
||||
histoire:build:
|
||||
sources:
|
||||
- src/lib/components/**
|
||||
generates:
|
||||
- .histoire/screenshots/**
|
||||
cmds:
|
||||
- histoire build
|
||||
|
||||
integrate:
|
||||
deps: [check]
|
||||
cmds:
|
||||
- git is-clean
|
||||
- git checkout main
|
||||
- git weld -
|
||||
|
||||
release:
|
||||
cmds:
|
||||
- standard-version -a
|
||||
|
@ -6,5 +6,5 @@ test("basic, initial store", () => {
|
||||
const state = store.getState();
|
||||
|
||||
expect(state).toHaveProperty("propulsion.drive.reqs.mass", 0);
|
||||
expect(state).toHaveProperty("structure.cargo.space", 0);
|
||||
// expect(state).toHaveProperty("structure.cargo.space", 0);
|
||||
});
|
||||
|
@ -7,7 +7,7 @@ import { reqs, Reqs } from "../reqs.js";
|
||||
|
||||
const ftl = createSlice({
|
||||
name: "ftl",
|
||||
initialState,
|
||||
initialState: {},
|
||||
reducers: {
|
||||
setFtl: (state, { payload }: PayloadAction<FtlType>) => {
|
||||
state.type = payload;
|
||||
|
@ -1 +0,0 @@
|
||||
import
|
@ -1,20 +1,12 @@
|
||||
import { combineReducers } from "redux";
|
||||
import * as R from "remeda";
|
||||
|
||||
import * as hull from "./hull.js";
|
||||
import * as screens from "./screen.js";
|
||||
import * as cargo from "./cargo.js";
|
||||
import * as armor from "./armor.js";
|
||||
import * as streamlining from "./streamlining.js";
|
||||
|
||||
export const reducer = combineReducers(
|
||||
R.mapValues(
|
||||
{
|
||||
hull,
|
||||
screens,
|
||||
cargo,
|
||||
armor,
|
||||
streamlining,
|
||||
},
|
||||
R.prop("reducer")
|
||||
)
|
||||
|
@ -22,6 +22,5 @@ const adfc = createSlice({
|
||||
|
||||
export const reducer = combineReducers({
|
||||
adfc: adfc.reducer,
|
||||
firecons: firecons.reducer,
|
||||
weapons: weapons.reducer,
|
||||
});
|
||||
|
@ -2,56 +2,60 @@ import { test, expect } from "vitest";
|
||||
import ship from "./ship";
|
||||
|
||||
test("kicking the tires", () => {
|
||||
const store = ship.createStore();
|
||||
store.dispatch.setFtlType("standard");
|
||||
const store = ship.createStore();
|
||||
store.dispatch.setFtlType("standard");
|
||||
|
||||
expect(store.getState().propulsion.ftl.reqs.mass).toEqual(1);
|
||||
expect(store.getState().identification.reqs.usedMass).toEqual(1);
|
||||
expect(store.getState().propulsion.ftl.reqs.mass).toEqual(1);
|
||||
expect(store.getState().identification.reqs.usedMass).toEqual(1);
|
||||
|
||||
store.dispatch.setDrive({ rating: 3, advanced: true });
|
||||
store.dispatch.setDrive({ rating: 3, advanced: true });
|
||||
|
||||
expect(store.getState().propulsion.drive.reqs).toEqual({ mass: 2, cost: 6 });
|
||||
expect(store.getState().propulsion.drive.reqs).toEqual({ mass: 2, cost: 6 });
|
||||
|
||||
store.dispatch.setNbrCarrierBays(1);
|
||||
expect(store.getState().carrier.nbrBays).toEqual(1);
|
||||
store.dispatch.setNbrCarrierBays(2);
|
||||
expect(store.getState().carrier.nbrBays).toEqual(2);
|
||||
store.dispatch.setNbrCarrierBays(1);
|
||||
expect(store.getState().carrier.nbrBays).toEqual(1);
|
||||
store.dispatch.setNbrCarrierBays(2);
|
||||
expect(store.getState().carrier.nbrBays).toEqual(2);
|
||||
|
||||
store.dispatch.setSquadronType(2, "fast");
|
||||
store.dispatch.setSquadronType(2, "fast");
|
||||
|
||||
expect(store.getState().carrier.squadrons[1]).toHaveProperty("type", "fast");
|
||||
expect(store.getState().carrier.squadrons[1]).toHaveProperty("type", "fast");
|
||||
|
||||
expect(store.getState.isCarrier()).toBe(true);
|
||||
expect(store.getState.isCarrier()).toBe(true);
|
||||
|
||||
store.dispatch.setStreamlining("partial");
|
||||
store.dispatch.setStreamlining("partial");
|
||||
|
||||
expect(store.getState.getStreamlining()).toBe("partial");
|
||||
expect(store.selectors.getStreamlining(store.getState())).toBe("partial");
|
||||
expect(store.getState.getStreamlining()).toBe("partial");
|
||||
expect(store.selectors.getStreamlining(store.getState())).toBe("partial");
|
||||
|
||||
store.dispatch.setCargo(3);
|
||||
expect(store.getState().structure.cargo).toEqual({
|
||||
space: 3,
|
||||
reqs: {
|
||||
mass: 3,
|
||||
cost: 0,
|
||||
},
|
||||
});
|
||||
store.dispatch.setCargo(3);
|
||||
expect(store.getState().structure.cargo).toEqual({
|
||||
space: 3,
|
||||
reqs: {
|
||||
mass: 3,
|
||||
cost: 0,
|
||||
},
|
||||
});
|
||||
|
||||
store.dispatch.setNbrArmorLayers(1);
|
||||
store.dispatch.setArmorRating(1, 3);
|
||||
store.dispatch.setNbrArmorLayers(1);
|
||||
store.dispatch.setArmorRating(1, 3);
|
||||
|
||||
expect(store.getState().structure.armor).toEqual({
|
||||
layers: [3],
|
||||
reqs: {
|
||||
cost: 6,
|
||||
mass: 6,
|
||||
},
|
||||
});
|
||||
expect(store.getState().structure.armor).toEqual({
|
||||
layers: [3],
|
||||
reqs: {
|
||||
cost: 6,
|
||||
mass: 6,
|
||||
},
|
||||
});
|
||||
|
||||
store.dispatch.addWeapon("beam");
|
||||
expect(store.getState().weaponry.weapons[0]).toEqual({
|
||||
id: 1,
|
||||
reqs: { cost: 3, mass: 1 },
|
||||
specs: { arcs: ["F"], type: "beam", weaponClass: 1 },
|
||||
});
|
||||
store.dispatch.addWeapon("beam");
|
||||
expect(store.getState().weaponry.weapons[0]).toEqual({
|
||||
id: 1,
|
||||
reqs: { cost: 3, mass: 1 },
|
||||
specs: {
|
||||
arcs: ["FS", "F", "FP", "AP", "A", "AS"],
|
||||
type: "beam",
|
||||
weaponClass: 1,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user