AsyncSeriesHooks.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const HookTester = require("./HookTester");
  7. const AsyncSeriesHook = require("../AsyncSeriesHook");
  8. const AsyncSeriesBailHook = require("../AsyncSeriesBailHook");
  9. const AsyncSeriesWaterfallHook = require("../AsyncSeriesWaterfallHook");
  10. const AsyncSeriesLoopHook = require("../AsyncSeriesLoopHook");
  11. describe("AsyncSeriesHook", () => {
  12. it("should have to correct behavior", async () => {
  13. const tester = new HookTester((args) => new AsyncSeriesHook(args));
  14. const result = await tester.run();
  15. expect(result).toMatchSnapshot();
  16. })
  17. })
  18. describe("AsyncSeriesBailHook", () => {
  19. it("should have to correct behavior", async () => {
  20. const tester = new HookTester((args) => new AsyncSeriesBailHook(args));
  21. const result = await tester.run();
  22. expect(result).toMatchSnapshot();
  23. })
  24. })
  25. describe("AsyncSeriesWaterfallHook", () => {
  26. it("should have to correct behavior", async () => {
  27. const tester = new HookTester((args) => new AsyncSeriesWaterfallHook(args));
  28. const result = await tester.run();
  29. expect(result).toMatchSnapshot();
  30. })
  31. })
  32. describe("AsyncSeriesLoopHook", () => {
  33. it("should have to correct behavior", async () => {
  34. const tester = new HookTester((args) => new AsyncSeriesLoopHook(args));
  35. const result = await tester.runForLoop();
  36. expect(result).toMatchSnapshot();
  37. })
  38. })