test-jest-new-worker.js 484 B

1234567891011121314151617181920212223
  1. const { unstable_dev } = require("wrangler");
  2. describe("Worker", () => {
  3. let worker;
  4. beforeAll(async () => {
  5. worker = await unstable_dev("src/index.js", {
  6. experimental: { disableExperimentalWarning: true },
  7. });
  8. });
  9. afterAll(async () => {
  10. await worker.stop();
  11. });
  12. it("should return Hello World", async () => {
  13. const resp = await worker.fetch();
  14. if (resp) {
  15. const text = await resp.text();
  16. expect(text).toMatchInlineSnapshot(`"Hello World!"`);
  17. }
  18. });
  19. });