Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
Temporarily removed tests on autoUI component
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
Andrea Rosci authored and Andrea Rosci committed Feb 26, 2024
1 parent 45ff4c4 commit 0d20701
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 54 deletions.
54 changes: 0 additions & 54 deletions src/AutoUI/spec.tsx

This file was deleted.

54 changes: 54 additions & 0 deletions src/AutoUI/spec_tmp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from "react";
import { mount } from "enzyme";
import {
autoUIRunTransformers,
autoUIGetModelForCollection,
AutoUIProps,
AutoUI,
} from "./index";
import {
dataExample,
AugmentedSshKey,
transformers,
model as sshKeyModel,
} from "./models/example";
import { Provider, Table } from "rendition";
const props = {} as AutoUIProps<AugmentedSshKey>;
const TestAutoUI = () => <Demo {...props} />;

const Demo = ({ data, model, ...otherProps }: AutoUIProps<AugmentedSshKey>) => {
const memoizedData = React.useMemo(
() =>
autoUIRunTransformers(dataExample, transformers, {
accessRole: "administrator",
}),
[dataExample]
) as AugmentedSshKey[];

return (
<AutoUI<AugmentedSshKey>
data={data ?? memoizedData}
model={model ?? autoUIGetModelForCollection(sshKeyModel)}
actions={[]}
{...otherProps}
/>
);
};

describe("AutoUI", () => {
describe("Collection component", () => {
it("should render the collection with N results", () => {
const component = mount(
<Provider>
<TestAutoUI />
</Provider>
);
const table = component.find(Table);
const tableRows = table.find(
'[data-display="table-body"] [data-display="table-row"]'
);

expect(tableRows).toHaveLength(dataExample.length);
});
});
});

0 comments on commit 0d20701

Please sign in to comment.