test: Firebase mock harness + createCampaign characterization

- src/__mocks__/firebase/*: jest manual mocks (app/auth/firestore)
- src/__mocks__/firebase/_mock-db.js: in-memory DB + call recorder
- src/setupTests.js: jest-dom, env stubs, crypto polyfill, DB reset
- src/App.characterization.test.js: createCampaign -> setDoc path/payload locked
- src/storage/contract.js (renamed from .test.js, helper not suite)

21 tests green (memory 19 + createCampaign 2).
This commit is contained in:
david raistrick
2026-06-28 17:59:50 -04:00
parent 12b24eb707
commit 84dd17e174
8 changed files with 273 additions and 1 deletions
+11
View File
@@ -0,0 +1,11 @@
// jest manual mock: firebase/auth
const fakeUser = { uid: 'test-user-123', isAnonymous: true };
const fakeAuth = { currentUser: fakeUser };
export function getAuth() { return fakeAuth; }
export function signInAnonymously(auth) { return Promise.resolve({ user: fakeUser }); }
export function signInWithCustomToken(auth, token) { return Promise.resolve({ user: fakeUser }); }
export function onAuthStateChanged(auth, cb) {
cb(fakeUser);
return () => {};
}