How to use @times-components/provider-test-tools - 10 common examples

To help you get started, we’ve selected a few @times-components/provider-test-tools 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 newsuk / times-components / packages / author-profile / __tests__ / author-profile-helper.js View on Github external
it("adds author profile fields to tracking context", () => {
    const reporter = jest.fn();
    const pageSize = 3;

    renderer.create(
      
        
      
    );

    expect(reporter).toHaveBeenCalledWith(
      expect.objectContaining({
        object: "AuthorProfile",
        attrs: expect.objectContaining({
          authorName: "Deborah Haynes",
          page: 1,
          pageSize
        })
github newsuk / times-components / packages / author-profile / __tests__ / author-profile-list-content.native.js View on Github external
it("renders page error", () => {
    const wrapper = shallow(
       {}}
        onTwitterLinkPress={() => {}}
        onArticlePress={() => {}}
        onViewed={() => {}}
      />
    );

    expect(
      wrapper
        .dive()
        .dive()
github newsuk / times-components / packages / topic / __tests__ / topic-styling.js View on Github external
it("should render styling correctly", () => {
    const pageSize = 3;
    const tree = renderer.create(
      
        
      
    );

    expect(tree).toMatchSnapshot();
  });
};
github newsuk / times-components / packages / author-profile / __tests__ / author-profile-list-content.native.js View on Github external
it("does not emit scroll tracking events for author profile content when nothing changed", () => {
    const reporter = jest.fn();
    const results = pagedResult(0, 3);
    const authorProfileContent = shallow(
       {}}
        onArticlePress={() => {}}
      />,
      {
        context: {
          tracking: {
            analytics: reporter
          }
        }
      }
    );
    authorProfileContent
github newsuk / times-components / packages / author-profile / __tests__ / author-profile-list-content.native.js View on Github external
it("emits scroll tracking events for author profile content", () => {
    const reporter = jest.fn();
    const results = pagedResult(0, 3);
    const authorProfileContent = shallow(
       {}}
        onArticlePress={() => {}}
      />,
      {
        context: {
          tracking: {
            analytics: reporter
          }
        }
      }
    );
    authorProfileContent
github newsuk / times-components / packages / author-profile / __tests__ / author-profile-helper.js View on Github external
it("renders profile loading", () => {
    const pageSize = 3;
    const component = renderer.create(
      
        
      
    );

    expect(component).toMatchSnapshot();
  });
github newsuk / times-components / packages / topic / __tests__ / topic-functional.js View on Github external
export default () => {
  const pageSize = 3;
  const slug = "chelsea";

  const mockArticles = fixtureGenerator.makeTopicArticleMocks({
    pageSize,
    withImages: true
  });

  const props = {
    adConfig: {},
    analyticsStream: () => {},
    isLoading: false,
    onArticlePress: () => {},
    page: 1,
    pageSize,
    refetch: () => {},
    slug,
    topic: {
      name: "Chelsea",
      description:
github newsuk / times-components / packages / article-list / __tests__ / paged-result.js View on Github external
export default (skip, first) => ({
  articles: {
    ...articleListWithImagesFixture.data.author.articles,
    list: articleListWithImagesFixture.data.author.articles.list.slice(
      skip,
      skip + first
    )
  }
});
github newsuk / times-components / packages / article-list / __tests__ / paged-result.js View on Github external
export default (skip, first) => ({
  articles: {
    ...articleListWithImagesFixture.data.author.articles,
    list: articleListWithImagesFixture.data.author.articles.list.slice(
      skip,
      skip + first
    )
  }
});
github newsuk / times-components / packages / article-magazine-comment / article-magazine-comment.showcase.js View on Github external
component: ({ select }, { decorateAction }) => {
        const id = "198c4b2f-ecec-4f34-be53-c89f83bc1b44";
        const scale = selectScales(select);
        const section = selectSection(select);

        return mockArticle({
          decorateAction,
          id,
          params: makeParams({
            error: () => new Error("Article error"),
            variables: () => ({
              id
            })
          }),
          scale,
          section
        });
      },
      name: "Magazine Comment - Error",