Tests
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
import { BunRuntime } from "@effect/platform-bun"
|
||||
import { Todo } from "@todo-tests/common/data"
|
||||
import { Array, Effect } from "effect"
|
||||
import { Array, Console, Effect, Stream } from "effect"
|
||||
import { TodoRepository, TodoRepositoryLive, createDefaultTodos } from "./TodoRepository"
|
||||
|
||||
|
||||
const watchTodoChanges = Effect.gen(function*() {
|
||||
const todos = yield* TodoRepository
|
||||
yield* Stream.runForEach(todos.todos.changes, todos => Console.log(`Todos changed: ${ todos }`))
|
||||
})
|
||||
|
||||
|
||||
const main = Effect.gen(function*() {
|
||||
const watcher = yield* Effect.fork(watchTodoChanges)
|
||||
yield* createDefaultTodos
|
||||
|
||||
const todos = yield* TodoRepository
|
||||
console.log(yield* todos.todos.get)
|
||||
// console.log(yield* todos.todos.get)
|
||||
|
||||
const secondTodo = yield* yield* todos.todos.get.pipe(
|
||||
Effect.map(Array.get(1))
|
||||
@@ -19,7 +26,7 @@ const main = Effect.gen(function*() {
|
||||
})
|
||||
|
||||
yield* todos.update(secondTodoModified)
|
||||
console.log(yield* todos.todos.get)
|
||||
// console.log(yield* todos.todos.get)
|
||||
})
|
||||
|
||||
const runnableMain = main.pipe(
|
||||
|
||||
Reference in New Issue
Block a user