def METHOD_NAME(outdir):
    """Test batch mode."""
    tap = SampleTapCountries(
        config={
            "batch_config": {
                "encoding": {
                    "format": "jsonl",
                    "compression": "gzip",
                },
                "storage": {
                    "root": outdir,
                    "prefix": "pytest-countries-",
                },
            },
        },
    )
    buf = io.StringIO()
    with redirect_stdout(buf):
        tap.sync_all()
    buf.seek(0)
    lines = buf.read().splitlines()
    messages = [json.loads(line) for line in lines]
    def tally_messages(messages: list) -> t.Counter:
        """Tally messages."""
        return t.Counter(
            (message["type"], message["stream"])
            if message["type"] != "STATE"
            else (message["type"],)
            for message in messages
        )
    counter = tally_messages(messages)
    assert counter["SCHEMA", "continents"] == 1
    assert counter["BATCH", "continents"] == 1
    assert counter["SCHEMA", "countries"] == 1
    assert counter["BATCH", "countries"] == 1
    assert counter[("STATE",)] == 3