Skip to content

Commit

Permalink
Revert "more files"
Browse files Browse the repository at this point in the history
This reverts commit 92a618c.
  • Loading branch information
grahamlangford committed Aug 19, 2024
1 parent c810d26 commit 5eb9e61
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 46 deletions.
23 changes: 10 additions & 13 deletions src/pageEditor/hooks/useSaveMod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import type { components } from "@/types/swagger";
import { editorSlice } from "@/pageEditor/store/editor/editorSlice";
import type { EditablePackageMetadata } from "@/types/contract";
import modComponentSlice from "@/store/modComponents/modComponentSlice";
import { type UUID } from "@/types/stringTypes";

const modId = validateRegistryId("@test/mod");

Expand All @@ -47,7 +46,7 @@ describe("useSaveMod", () => {
const definition = defaultModDefinitionFactory({
metadata: {
id: editablePackage.name,
name: editablePackage.verbose_name!,
name: editablePackage.verbose_name,
version: editablePackage.version as SemVerString,
},
});
Expand Down Expand Up @@ -96,7 +95,7 @@ describe("useSaveMod", () => {
const definition = defaultModDefinitionFactory({
metadata: {
id: editablePackage.name,
name: editablePackage.verbose_name!,
name: editablePackage.verbose_name,
version: editablePackage.version as SemVerString,
},
options: {
Expand Down Expand Up @@ -149,7 +148,7 @@ describe("useSaveMod", () => {

const yamlConfig = (
JSON.parse(
putMock.history.put![0]!.data,
putMock.history.put[0].data,
) as components["schemas"]["Package"]
).config;

Expand All @@ -175,7 +174,7 @@ describe("useSaveMod", () => {
const definition = defaultModDefinitionFactory({
metadata: {
id: editablePackage.name,
name: editablePackage.verbose_name!,
name: editablePackage.verbose_name,
version: editablePackage.version as SemVerString,
},
});
Expand Down Expand Up @@ -231,7 +230,7 @@ describe("useSaveMod", () => {

const yamlConfig = (
JSON.parse(
putMock.history.put![0]!.data,
putMock.history.put[0].data,
) as components["schemas"]["Package"]
).config;

Expand All @@ -256,11 +255,11 @@ describe("isModEditable", () => {
const mod = defaultModDefinitionFactory();
const editablePackages: EditablePackageMetadata[] = [
{
id: null as unknown as UUID,
id: null,
name: validateRegistryId("test/mod"),
},
{
id: null as unknown as UUID,
id: null,
name: mod.metadata.id,
},
] as EditablePackageMetadata[];
Expand All @@ -272,7 +271,7 @@ describe("isModEditable", () => {
const mod = defaultModDefinitionFactory();
const editablePackages: EditablePackageMetadata[] = [
{
id: null as unknown as UUID,
id: null,
name: validateRegistryId("test/mod"),
},
] as EditablePackageMetadata[];
Expand All @@ -283,13 +282,11 @@ describe("isModEditable", () => {
test("returns false if mod is null", () => {
const editablePackages: EditablePackageMetadata[] = [
{
id: null as unknown as UUID,
id: null,
name: validateRegistryId("test/mod"),
},
] as EditablePackageMetadata[];

expect(
isModEditable(editablePackages, null as unknown as ModDefinition),
).toBe(false);
expect(isModEditable(editablePackages, null)).toBe(false);
});
});
2 changes: 1 addition & 1 deletion src/pageEditor/modListingPanel/ModListItem.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("ModListItem", () => {
}),
);
render(
<Accordion>
<Accordion defaultActiveKey={null}>
<ListGroup>
<ModListItem
modMetadata={modMetadata}
Expand Down
2 changes: 1 addition & 1 deletion src/pageEditor/modals/addBrickModal/AddBrickModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe("AddBrickModal", () => {
exact: false,
});

await userEvent.click(tags.at(-1)!);
await userEvent.click(tags.at(-1));

// Enter a query
await userEvent.type(screen.getByTestId("tag-search-input"), "google");
Expand Down
2 changes: 1 addition & 1 deletion src/pageEditor/starterBricks/base.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe("removeEmptyValues()", () => {
test("convert undefined to null in expression values", () => {
expect(
removeEmptyValues({
foo: toExpression("nunjucks", undefined as unknown as null),
foo: toExpression("nunjucks", undefined),
}),
).toStrictEqual({
foo: toExpression("nunjucks", null),
Expand Down
20 changes: 10 additions & 10 deletions src/pageEditor/starterBricks/pipelineMapping.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe("normalizePipeline", () => {
const actual = await normalizePipelineForEditor(pipeline);

// Checking the loop config
const loopConfig = actual[0]!.config.body;
const loopConfig = actual[0].config.body;
expect(isPipelineExpression(loopConfig)).toBeTrue();
for (const config of (loopConfig as PipelineExpression).__value__) {
expect(config.instanceId).toBeDefined();
Expand Down Expand Up @@ -133,15 +133,15 @@ describe("normalizePipeline", () => {
const actual = await normalizePipelineForEditor(pipeline);

// Checking IF branch
const ifConfig = actual[0]!.config.if;
const ifConfig = actual[0].config.if;
expect(isPipelineExpression(ifConfig)).toBeTrue();
const ifConfigPipeline = ifConfig as PipelineExpression;
for (const config of ifConfigPipeline.__value__) {
expect(config.instanceId).toBeDefined();
}

// ELSE branch should be undefined
expect(actual[0]!.config.else).toBeUndefined();
expect(actual[0].config.else).toBeUndefined();
});

test("Try-Except block", async () => {
Expand Down Expand Up @@ -185,15 +185,15 @@ describe("normalizePipeline", () => {
const actual = await normalizePipelineForEditor(pipeline);

// Checking TRY branch
const tryConfig = actual[0]!.config.try;
const tryConfig = actual[0].config.try;
expect(isPipelineExpression(tryConfig)).toBeTrue();
const tryConfigPipeline = tryConfig as PipelineExpression;
for (const config of tryConfigPipeline.__value__) {
expect(config.instanceId).toBeDefined();
}

// EXCEPT branch should be undefined
expect(actual[0]!.config.except).toBeUndefined();
expect(actual[0].config.except).toBeUndefined();
});

test("nested pipelines", async () => {
Expand All @@ -220,13 +220,13 @@ describe("normalizePipeline", () => {

// 2nd level
const loopConfig1: PipelineExpression = actual[0].config.body;
expect(loopConfig1.__value__[0]!.instanceId).toBeDefined();
expect(loopConfig1.__value__[0].instanceId).toBeDefined();

// 3d level
expect(
isPipelineExpression(loopConfig1.__value__[0]!.config.body),
isPipelineExpression(loopConfig1.__value__[0].config.body),
).toBeTrue();
const loopConfig2 = loopConfig1.__value__[0]!.config
const loopConfig2 = loopConfig1.__value__[0].config
.body as PipelineExpression;
expect(loopConfig2.__value__).toHaveLength(2);
for (const config of loopConfig2.__value__) {
Expand Down Expand Up @@ -365,10 +365,10 @@ describe("omitEditorMetadata", () => {

// 2nd level
const loopConfig1: PipelineExpression = actual[0].config.body;
expect(loopConfig1.__value__[0]!.instanceId).toBeUndefined();
expect(loopConfig1.__value__[0].instanceId).toBeUndefined();

// 3d level
const loopConfig2 = loopConfig1.__value__[0]!.config
const loopConfig2 = loopConfig1.__value__[0].config
.body as PipelineExpression;
expect(loopConfig2.__value__).toHaveLength(2);
for (const config of loopConfig2.__value__) {
Expand Down
28 changes: 14 additions & 14 deletions src/pageEditor/store/editor/editorSlice.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function getTabState(
state: EditorState,
tabKey: DataPanelTabKey = DataPanelTabKey.Input,
) {
return state.brickPipelineUIStateById[state.activeModComponentId!]!
.nodeUIStates[FOUNDATION_NODE_ID]!.dataPanel[tabKey];
return state.brickPipelineUIStateById[state.activeModComponentId]
.nodeUIStates[FOUNDATION_NODE_ID].dataPanel[tabKey];
}

const GOOGLE_SHEET_INTEGRATION_ID = validateRegistryId("google/sheet");
Expand Down Expand Up @@ -154,7 +154,7 @@ describe("Add/Remove Bricks", () => {
test("Add Brick", async () => {
// Get initial bricks
const initialBricks =
editor.modComponentFormStates[0]!.modComponent.brickPipeline;
editor.modComponentFormStates[0].modComponent.brickPipeline;

// Add a Brick
editor = editorSlice.reducer(
Expand All @@ -168,51 +168,51 @@ describe("Add/Remove Bricks", () => {

// Ensure we have one more brick than we started with
expect(
editor.modComponentFormStates[0]!.modComponent.brickPipeline,
editor.modComponentFormStates[0].modComponent.brickPipeline,
).toBeArrayOfSize(initialBricks.length + 1);
});

test("Remove Brick with Integration Dependency", async () => {
// Get initial bricks and integration dependencies
const initialBricks =
editor.modComponentFormStates[0]!.modComponent.brickPipeline;
editor.modComponentFormStates[0].modComponent.brickPipeline;
const initialIntegrationDependencies =
editor.modComponentFormStates[0]!.integrationDependencies;
editor.modComponentFormStates[0].integrationDependencies;

// Remove the brick with integration dependency
editor = editorSlice.reducer(
editor,
actions.removeNode(brickWithIntegration.instanceId!),
actions.removeNode(brickWithIntegration.instanceId),
);

// Ensure Integration Dependency was removed
expect(
editor.modComponentFormStates[0]!.modComponent.brickPipeline,
editor.modComponentFormStates[0].modComponent.brickPipeline,
).toBeArrayOfSize(initialBricks.length - 1);
expect(
editor.modComponentFormStates[0]!.integrationDependencies,
editor.modComponentFormStates[0].integrationDependencies,
).toBeArrayOfSize(initialIntegrationDependencies.length - 1);
});

test("Remove Brick without Integration Dependency", async () => {
// Get initial bricks and integrations
const initialBricks =
editor.modComponentFormStates[0]!.modComponent.brickPipeline;
editor.modComponentFormStates[0].modComponent.brickPipeline;
const initialIntegrationDependencies =
editor.modComponentFormStates[0]!.integrationDependencies;
editor.modComponentFormStates[0].integrationDependencies;

// Remove the brick with integration
editor = editorSlice.reducer(
editor,
actions.removeNode(standardBrick.instanceId!),
actions.removeNode(standardBrick.instanceId),
);

// Ensure integration was NOT removed
expect(
editor.modComponentFormStates[0]!.modComponent.brickPipeline,
editor.modComponentFormStates[0].modComponent.brickPipeline,
).toBeArrayOfSize(initialBricks.length - 1);
expect(
editor.modComponentFormStates[0]!.integrationDependencies,
editor.modComponentFormStates[0].integrationDependencies,
).toBeArrayOfSize(initialIntegrationDependencies.length);
});

Expand Down
6 changes: 0 additions & 6 deletions src/tsconfig.strictNullChecks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
"strictNullChecks": true
},
"files": [
"./pageEditor/hooks/useSaveMod.test.ts",
"./pageEditor/modals/addBrickModal/AddBrickModal.test.tsx",
"./pageEditor/modListingPanel/ModListItem.test.tsx",
"./pageEditor/starterBricks/base.test.ts",
"./pageEditor/starterBricks/pipelineMapping.test.ts",
"./pageEditor/store/editor/editorSlice.test.ts",
"./pageEditor/store/editor/editorSliceHelpers.test.ts",
"./pageEditor/tabs/editTab/dataPanel/BrickDataPanel.test.tsx",
"./pageEditor/tabs/editTab/dataPanel/StarterBrickDataPanel.test.tsx",
Expand Down

0 comments on commit 5eb9e61

Please sign in to comment.