Add more tests

This commit is contained in:
Joey Yakimowich-Payne 2026-01-15 07:08:50 -07:00
commit 5974134ad8
No known key found for this signature in database
GPG key ID: 6BFE655FA5ABD1E1
7 changed files with 1418 additions and 231 deletions

View file

@ -29,6 +29,7 @@ export const useQuizLibrary = (): UseQuizLibraryReturn => {
const [saving, setSaving] = useState(false);
const [error, setError] = useState<string | null>(null);
const lastOperationRef = useRef<(() => Promise<void>) | null>(null);
const savingRef = useRef(false);
const fetchQuizzes = useCallback(async () => {
if (!isAuthenticated) return;
@ -88,7 +89,7 @@ export const useQuizLibrary = (): UseQuizLibraryReturn => {
source: QuizSource,
aiTopic?: string
): Promise<string> => {
if (saving) {
if (savingRef.current) {
toast.error('Save already in progress');
throw new Error('Save already in progress');
}
@ -117,6 +118,7 @@ export const useQuizLibrary = (): UseQuizLibraryReturn => {
}
}
savingRef.current = true;
setSaving(true);
setError(null);