How to use @frontity/connect - 9 common examples

To help you get started, weโ€™ve selected a few @frontity/connect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frontity / frontity / packages / wp-source / src / __tests__ / actions.tests.ts View on Github external
});
  const config = wpSource();

  // add a handler for tests
  config.libraries.source.handlers.push({
    name: "always",
    priority: 0,
    pattern: "/(.*)",
    func: handler
  });

  // replace the mocked fetch by the real one we want to test
  config.actions.source.fetch = actions.fetch;
  // replace the mocked init by the real one we want to test
  config.actions.source.init = actions.init;
  return createStore(config);
};
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / post.tests.ts View on Github external
const config = wpSource();
  const { api, populate } = config.libraries.source;

  // mock api
  (api.get as jest.Mock).mockResolvedValue(mockResponse([post60]));

  // mock populate
  (populate as jest.Mock).mockResolvedValue([
    {
      id: 60,
      slug: "the-beauties-of-gullfoss",
      link: "https://test.frontity.io/2016/the-beauties-of-gullfoss/"
    }
  ]);

  store = createStore(config);
});
github frontity / frontity / packages / head-tags / src / __tests__ / state.tests.ts View on Github external
beforeEach(() => {
  warn.mockClear();

  // Create store.
  const config: HeadTagsPackage = clone(headTagsPackage());

  // Mock wp-source state.
  config.state.source = clone(wpSource()).state.source;
  config.state.source.api = "https://test.frontity.io/wp-json";
  // Mock router state.
  config.state.router = { link: "/" };
  // Mock site url.
  config.state.frontity = { url: "https://mars.frontity.org" };
  // Initialize store.
  store = createStore(config);
});
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / author.tests.ts View on Github external
beforeEach(() => {
  store = createStore(clone(wpSource()));
  store.actions.source.init();
  api = store.libraries.source.api as jest.Mocked;
});
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / tag.tests.ts View on Github external
beforeEach(() => {
  store = createStore(clone(wpSource()));
  store.actions.source.init();
  api = store.libraries.source.api as jest.Mocked;
});
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / post-type.tests.ts View on Github external
beforeEach(() => {
  store = createStore(clone(wpSource()));
  store.actions.source.init();
  api = store.libraries.source.api as jest.Mocked;
});
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / date.tests.ts View on Github external
beforeEach(() => {
  store = createStore(clone(wpSource()));
  store.actions.source.init();
  api = store.libraries.source.api as jest.Mocked;
});
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / post-archive.tests.ts View on Github external
beforeEach(() => {
  store = createStore(clone(wpSource()));
  store.actions.source.init();
  api = store.libraries.source.api as jest.Mocked;
});
github frontity / frontity / packages / wp-source / src / libraries / handlers / __tests__ / category.tests.ts View on Github external
beforeEach(() => {
  store = createStore(clone(wpSource()));
  store.actions.source.init();
  api = store.libraries.source.api as jest.Mocked;
});

@frontity/connect

The state manager of Frontity. Similar to MobX but much more lightweight because it's based on ES6 proxies.

Apache-2.0
Latest version published 4 years ago

Package Health Score

60 / 100
Full package analysis

Popular @frontity/connect functions