import { Process, task, api, specHelper } from "actionhero";

describe("Task: %%name%%", () => {
  const actionhero = new Process();

  beforeAll(async () => await actionhero.start());
  afterAll(async () => await actionhero.stop());

  beforeEach(async () => {
    await api.resque.queue.connection.redis.flushdb();
  });

  test("can be enqueued", async () => {
    await task.enqueue("%%name%%", {});
    const found = await specHelper.findEnqueuedTasks("%%name%%");
    expect(found.length).toEqual(1);
    expect(found[0].timestamp).toBeNull();
  });
});

