Created
April 12, 2020 21:41
-
-
Save dpchamps/7ef4739b5674e6713c51f9d1f22a95e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("Should preserve boundaries after the program has run", async () => { | |
const boundary = createBoundary(); | |
const handler: Handler = { | |
*[DefaultEffectHandler](_, resume) { | |
return yield resume("it works!"); | |
} | |
}; | |
function* root() { | |
yield boundary.withContext(); | |
return yield "complete"; | |
} | |
const programResult = await runProgram(withHandler(handler, root())); | |
expect(programResult).toBe("complete"); | |
const result = await boundary.into(function*() { | |
return yield performEffect({ type: "anything at all" }); | |
})(); | |
expect(result).toBe("it works!"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment