This repository has been archived by the owner on Jan 16, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporarily removed tests on autoUI component
Change-type: patch
- Loading branch information
Andrea Rosci
authored and
Andrea Rosci
committed
Feb 23, 2024
1 parent
94da27c
commit 30e14bd
Showing
2 changed files
with
54 additions
and
54 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); | ||
}); |