Skip to content

Full stack testing

Petter Eriksson edited this page Dec 6, 2017 · 3 revisions

By having most of our client code and UI code written in .cljc, we both get server side rendering (SSR) and makes it quite easy to write full stack tests. Running the entire app within the same JVM.

Checkout eponai.fullstack2.tests in the test directory. I've regretted calling this namespace tests many times, but we never got around to renaming it.

The setup for a full stack test is:

  • Our server
  • Any number of clients, which is defined as om.next/reconcilers.
    • Each reconciler's :send-fn is configured to call the server.

Here are some properties of this setup:

  • Each client has their own app-state.
  • It's possible to execute om.next/transact! on the clients individually
    • An om.next/transact! can possibly send requests to the server.
  • It's possible to await responses for each transact.
  • The server can return html

Here are some ideas off the top of our heads:

  • Test data sync between clients. They should (in some cases) end up with the same state.
  • Parse the html returned to by the server to validate some properties.
  • Define properties for each mutation and run them full stack.
  • Define properties for each route on the site, walk the application by parsing html and triggering the anchor tags.

We think there's a lot of unexplored power here.