-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Hello! First of all, congratulations on the amazing job. Both on the communication and the library itself - I got to learn about it yesterday and I'm loving it.
I followed the main tutorial on the README.md file and I noticed some details that made me a little confused, but I could make it work with some limitations. I intend to understand what is happening so I can contribute in any way.
The main part is that I tried following it using eventually@5.7.x, but it looks like some things changed after it was written.
I wrote a sample (working) project here. The latest-eventually-version branch has my tests on 5.7, and the main branch is on 5.0. I'll focus on 5.7 on this Github issue.
InMemorySnapshotStore is now deprecated
The tutorial recommends me to do something like this in the tests:
describe("Room", () => {
const snapshotStore = InMemorySnapshotStore();
// ....
});The issue is that it was removed in this commit. I understand the motivation behind the deprecation, but I'd like to know how can we properly test on the new version.
So on the "lookup" test scenario, I wasn't able to assert that three records were created, so I tested the lookup individually, like this:
it("allows pokemon to be looked up", async () => {
const pokemon = await client().load(Pokemon, "pokemon-1");
expect(pokemon.state.name).toBe("Bulbasaur");
});Is there a way to still test the total records in the store?
Snapshot return typing
This is more like an "I don't know what I'm doing" than an issue with the lib, but here it goes:
This happens similarly, both on 5.0 and 5.7.
describe("and the pokemon is caught", () => {
it("registers the pokemon as caught", async () => {
// patches Math.random to force success
Math.random = jest.fn().mockReturnValue(0.9);
// Load bulbasaur
const pokemon = await client().load(Pokemon, "pokemon-1");
// Throw a pokeball at it
const result = await throwPokeball(pokemon.state.pokedexNumber, { id: 1, success: true });
expect(result.state.catchAttempts.length).toBe(1);
// the value below is typed as `models.CatchAttempt`, not a Snapshot of it
// typescript doesn't let me access `.data`, although it exists
// the test below passes normally, but the static check doesn't unless I cast it
const attempt = result.state.catchAttempts[0] as any;
expect(attempt.data.success).toBe(true);
});
});Here's a link for the full file
I'm thinking that I did something wrong, but not sure what.
Live API schema documentation
I couldn't make it work based on the documentation, I'm seeing the following screen:

I didn't find in the documentation where I should set this version field, is it in package.json?
I intend to learn the answers to those questions and then contribute to the repository by suggesting updates on the documentation, so count on me if I can help with anything.
Thank you in advance, and again, amazing job.