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:
gitstart-twenty
2024-01-12 18:05:56 +01:00
committed by GitHub
parent 284fabf17c
commit d05d7ec1d1
10 changed files with 830 additions and 1 deletions

View File

@ -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);
});
});