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

To help you get started, we’ve selected a few @times-components/test-utils 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 / pages / __tests__ / puzzle-count-sync.js View on Github external
const count = 12;

    getOpenedPuzzleCount.mockReturnValue(Promise.resolve(count));

    const testInstance = TestRenderer.create(
      
    );

    // Initial Count
    expect(testInstance.toJSON()).toEqual(`${initialCount}`);

    // Updated Count with native bridge
    await delay(0);
    expect(testInstance.toJSON()).toEqual(`${count}`);
  });
};
github newsuk / times-components / packages / save-star-web / __tests__ / shared.base.js View on Github external
it("check that the event default is properly prevented", async () => {
      const testInstance = TestRenderer.create(
        
      );

      const [saveStarLink] = testInstance.root.findAllByType(Link);
      await delay(0);

      const preventDefault = jest.fn();
      saveStarLink.props.onPress({ preventDefault });

      expect(preventDefault).toHaveBeenCalled();
    });
  });
github newsuk / times-components / packages / tealium / __tests__ / web / scheduler.js View on Github external
it("should send multiple events", async () => {
        setup();

        const e1 = { component: "Page1" };
        const e2 = { component: "Page2" };

        sendScheduler.enqueue(e1);
        sendScheduler.enqueue(e2);

        await delayAndAdvance(1000);
        expect(global.window.tealiumTrack).toHaveBeenCalledTimes(2);
      });
github newsuk / times-components / packages / article-image / __tests__ / shared.base.js View on Github external
}
        };

        expect(
          makeTest(
            
          )
        ).toMatchSnapshot();
      }
    }
  ];

  iterator(tests);
};
github newsuk / times-components / packages / article-topics / __tests__ / shared.base.js View on Github external
test: () => {
        const testInstance = TestRenderer.create(
           {}}
            slug="test-slug"
          />
        );

        expect(testInstance).toMatchSnapshot();
      }
    }
  ];

  iterator(tests);
};
github newsuk / times-components / packages / article-list / __tests__ / shared-pagination.web.js View on Github external
.find("ArticleListPagination")
          .at(1)
          .dive()
          .find("WithTrackEvents(Pagination)")
          .dive()
          .dive()
          .find("Link")
          .props()
          .onPress();

        spy.mockRestore();
      }
    }
  ];

  iterator(tests);
};
github newsuk / times-components / packages / svgs / __tests__ / shared.js View on Github external
fillOpacity="0.4"
            height="100"
            stroke="rgb(255,255,255)"
            strokeWidth="8"
            width="100"
            x="5"
            y="10"
          />
        );

        expect(testInstance).toMatchSnapshot();
      }
    }
  ];

  iterator(tests);
};
github newsuk / times-components / packages / article-image / __tests__ / shared-with-style.base.js View on Github external
{
      name: "secondary image with caption and credits",
      test: () => {
        expect(
          makeTest(
            
          )
        ).toMatchSnapshot();
      }
    }
  ];

  iterator(tests);
};
github newsuk / times-components / packages / article-list / __tests__ / shared-error.base.native.js View on Github external
const testInstance = TestRenderer.create(
           {}}
            pageSize={3}
            refetch={() => {}}
          />
        );

        expect(testInstance).toMatchSnapshot();
      }
    }
  ];

  iterator(tests);
};
github newsuk / times-components / packages / topic / __tests__ / topic-functional.js View on Github external
{...props}
              analyticsStream={reporter}
              page={1}
              pageSize={pageSize}
            />
          
        );

        const call = reporter.mock.calls[0][0];

        expect(call).toMatchSnapshot();
      }
    }
  ];

  iterator(tests);
};

@times-components/test-utils

Test helpers for Times Components

BSD-3-Clause
Latest version published 1 month ago

Package Health Score

87 / 100
Full package analysis