import {expect, it, vi} from "vitest";
import NoAction from "./NoAction";

global.console.log = vi.fn();
global.console.warn = vi.fn();

it('warns on console if submit is called and logs data', async () => {
    //Arrange
    const dataToSubmit = {
        test: "test"
    };
    const submitStrategy = new NoAction();

    //Act
    submitStrategy.submit(dataToSubmit);

    //Assert
    expect(global.console.warn)
        .toHaveBeenCalledWith("This form has no submit action, data:");

    expect(global.console.log)
        .toHaveBeenCalledWith(dataToSubmit);
});