import assert from "assert";
import strictEval from "strict-eval";
import fs from "fs";
import url from "node:url";
import path from "node:path";
import { describe, it } from "node:test";

const __filename__ = url.fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename__);
const Code = fs.readFileSync(path.join(__dirname, "../../src/for-in/for-in-object-example.js"), "utf-8");
describe("for-in-object", function() {
    it("オブジェクトのkey:valueが列挙される", function() {
        const actualLogs = [];
        const console = {
            log(message) {
                actualLogs.push(message);
            }
        };
        strictEval(Code, {
            console
        });
        assert.deepEqual(actualLogs, [
            "key:a, value:1",
            "key:b, value:2",
            "key:c, value:3",
        ]);
    });
});
