# Development
As this library is basically a Vuex (opens new window)-Plugin, some unexpected weirdness may come the way of a developer. Most of which come down to naming differences between the {json:api} and the Vuex contexts:
- Resource types in {json:api} are namespaced modules in Vuex
- This library makes rather extensive use of Proxy (opens new window) objects, mostly to keep Vuex's reactivity magic getting to places where it would do more harm than good.
# Testing
The test setup is based around Jest (opens new window), Fetch Mock (opens new window) and the Vue Test Utils (opens new window).
When testing interactions against a {json:api}, tests/apiMock.js
provides a few helpers:
Method | Description |
---|---|
initApiMockServer(): void | Configures fetch-mock with several correct {json:api} responses |
initApiMock(): ResourcefulApi | Configures a ResourcefulApi against the mock server methods |
getVuexContextForResourceType(ResourcefulApi api, string type): { commit, dispatch, getters, state } | Returns the Vuex context from a configured api module |