Make api name editable and add expiry (#6473)
Fixes #6302 --------- Co-authored-by: martmull <martmull@hotmail.fr>
This commit is contained in:
@ -1,27 +0,0 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
@ -1,13 +0,0 @@
|
||||
import { useRecoilCallback } from 'recoil';
|
||||
|
||||
import { generatedApiKeyFamilyState } from '@/settings/developers/states/generatedApiKeyFamilyState';
|
||||
|
||||
export const useGeneratedApiKeys = () => {
|
||||
return useRecoilCallback(
|
||||
({ set }) =>
|
||||
(apiKeyId: string, apiKey: string | null) => {
|
||||
set(generatedApiKeyFamilyState(apiKeyId), apiKey);
|
||||
},
|
||||
[],
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user