Add tests for modules/people, modules/pipeline, modules/search and modules/settings (#3395)
Co-authored-by: gitstart-twenty <gitstart-twenty@users.noreply.github.com> Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Thiago Nascimbeni <tnascimbeni@gmail.com>
This commit is contained in:
@ -0,0 +1,27 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot, RecoilState } from 'recoil';
|
||||
|
||||
import { generatedApiKeyFamilyState } from '@/settings/developers/states/generatedApiKeyFamilyState';
|
||||
|
||||
import { useGeneratedApiKeys } from '../useGeneratedApiKeys';
|
||||
|
||||
describe('useGeneratedApiKeys', () => {
|
||||
test('should set generatedApiKeyFamilyState correctly', () => {
|
||||
const { result } = renderHook(() => useGeneratedApiKeys(), {
|
||||
wrapper: RecoilRoot,
|
||||
});
|
||||
|
||||
const apiKeyId = 'someId';
|
||||
const apiKey = 'someKey';
|
||||
|
||||
act(() => {
|
||||
result.current(apiKeyId, apiKey);
|
||||
});
|
||||
|
||||
const recoilState: RecoilState<string | null | undefined> =
|
||||
generatedApiKeyFamilyState(apiKeyId);
|
||||
|
||||
const stateValue = recoilState.key;
|
||||
expect(stateValue).toContain(apiKeyId);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user