-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathFile.context.test.js
43 lines (35 loc) · 1.31 KB
/
File.context.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React, {useContext} from "react";
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { AuthenticationContextProvider, FileContextProvider, RepositoryContextProvider } from "../src";
import { FileContext } from '../src/components/file/File.context';
const FileContextCustomer = () => {
const fileContextValues = useContext(FileContext);
const fileContextKeysArray = Object.keys(fileContextValues);
return(
<div
data-testid="test"
>
{
fileContextKeysArray.map((key)=>(`${key}/`))
}
</div>
)
}
describe('FileContextProvider', () => {
test('FileContextProvider renders correctly', () => {
render(
<AuthenticationContextProvider>
<RepositoryContextProvider
onRepository={()=>{}}
>
<FileContextProvider>
<FileContextCustomer text="text" data-testid="test"/>
</FileContextProvider>
</RepositoryContextProvider>
</AuthenticationContextProvider>
);
const test = screen.getByTestId('test');
expect(test).toHaveTextContent('state/stateValues/actions/component/components/config');
});
})