{"size": 1646, "ext": "js", "max_stars_repo_path": "test/noBids.js", "max_stars_repo_name": "HotAli7/BidifyUI", "max_stars_repo_stars_event_min_datetime": "2021-12-12T22:45:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-12T22:45:25.000Z", "max_issues_repo_path": "test/noBids.js", "max_issues_repo_name": "HotAli7/BidifyUI", "max_issues_repo_issues_event_min_datetime": "2021-08-04T19:25:58.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-04T19:25:58.000Z", "max_forks_repo_path": "test/noBids.js", "max_forks_repo_name": "HotAli7/BidifyUI", "max_forks_repo_forks_event_min_datetime": "2021-06-07T13:42:58.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-14T23:08:16.000Z"}
{"max_stars_count": 1, "max_issues_count": 1, "max_forks_count": 5, "avg_line_length": 37.4090909091, "max_line_length": 74, "alphanum_fraction": 0.634872418}
// Tests the NFT can be claimed back if no bids occur

const Bidify = artifacts.require("Bidify");
let ERC721 = artifacts.require("ERC721");

contract("Bidify", (accounts) => {
  it("should return the NFT if no bids occur", async () => {
    let instance = await Bidify.new();
    ERC721 = await ERC721.new("", "");

    let token = 100;
    await ERC721._mint(token, { from: accounts[1] });
    await ERC721.approve(instance.address, token, { from: accounts[1] });

    await instance.list("0x0000000000000000000000000000000000000000",
                          ERC721.address, token, web3.utils.toWei("1"),
                          5, "0x0000000000000000000000000000000000000000",
                          false, { from: accounts[1] }
                       );

    let listing = await instance.getListing.call(0);
    let lastBlock = await web3.eth.getBlock("latest");
    await new Promise((resolve) => web3.currentProvider.send({
      jsonrpc: "2.0",
      method: "evm_increaseTime",
      params: [listing.endTime - lastBlock.timestamp], id: null
    }, () => resolve()));

    let finish = await instance.finish(0, { from: accounts[1] });

    finish = finish.logs;
    assert.strictEqual(finish.length, 1);
    finish = finish[0];
    assert.strictEqual(finish.event, "AuctionFinished");
    finish = finish.args;
    assert.strictEqual(finish.id.toString(), "0");
    assert.strictEqual(finish.nftRecipient, accounts[1]);
    assert.strictEqual(finish.price.toString(), "0");

    assert.strictEqual((await instance.getListing.call(0)).paidOut, true);
    assert.strictEqual(await ERC721.ownerOf.call(token), accounts[1]);
  });
});
