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:
@@ -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 () => {};
|
||||
}
|
||||
Reference in New Issue
Block a user