mirror of
https://github.com/BlowaterNostr/blowater.git
synced 2024-10-18 15:43:20 +00:00
Create contact-list.test.tsx
This commit is contained in:
parent
60d1155f81
commit
0ab4fc0861
43
UI/contact-list.test.tsx
Normal file
43
UI/contact-list.test.tsx
Normal file
@ -0,0 +1,43 @@
|
||||
/** @jsx h */
|
||||
import { h, render } from "https://esm.sh/preact@10.17.1";
|
||||
import { ContactList } from "./contact-list.tsx";
|
||||
import { fail } from "https://deno.land/std@0.176.0/testing/asserts.ts";
|
||||
import { Database_Contextual_View } from "../database.ts";
|
||||
import { PrivateKey } from "../lib/nostr-ts/key.ts";
|
||||
import { InMemoryAccountContext } from "../lib/nostr-ts/nostr.ts";
|
||||
import { testEventBus, testEventsAdapter } from "./_setup.test.ts";
|
||||
import { ConnectionPool } from "../lib/nostr-ts/relay.ts";
|
||||
import { initialModel } from "./app_model.ts";
|
||||
import { AllUsersInformation } from "./contact-list.ts";
|
||||
import { ProfilesSyncer } from "../features/profile.ts";
|
||||
|
||||
const ctx = InMemoryAccountContext.New(PrivateKey.Generate());
|
||||
const database = await Database_Contextual_View.New(testEventsAdapter, ctx);
|
||||
if (database instanceof Error) {
|
||||
fail(database.message);
|
||||
}
|
||||
const allUserInfo = new AllUsersInformation(ctx);
|
||||
// allUserInfo.addEvents([e]);
|
||||
const pool = new ConnectionPool();
|
||||
const model = initialModel();
|
||||
const profileSyncer = new ProfilesSyncer(database, pool);
|
||||
|
||||
render(
|
||||
<ContactList
|
||||
database={database}
|
||||
emit={testEventBus.emit}
|
||||
userInfoMap={allUserInfo.userInfos}
|
||||
currentSelected={ctx.publicKey}
|
||||
editors={model.editors}
|
||||
hasNewMessages={new Set()}
|
||||
myAccountContext={ctx}
|
||||
search={model.dm.search}
|
||||
selectedContactGroup={model.dm.selectedContactGroup}
|
||||
profileSyncer={profileSyncer}
|
||||
/>,
|
||||
document.body,
|
||||
);
|
||||
|
||||
for await (const e of testEventBus.onChange()) {
|
||||
console.log(e);
|
||||
}
|
Loading…
Reference in New Issue
Block a user