require 'rails_helper'

RSpec.describe "tokens/edit", type: :view do
  let(:token) {
    Token.create!(
      canister_id: "MyString",
      standard: 1,
      symbol: "MyString",
      name: "MyString",
      total_supply: "",
      decimals: 1,
      transfer_fee: ""
    )
  }

  before(:each) do
    assign(:token, token)
  end

  it "renders the edit token form" do
    render

    assert_select "form[action=?][method=?]", token_path(token), "post" do

      assert_select "input[name=?]", "token[canister_id]"

      assert_select "input[name=?]", "token[standard]"

      assert_select "input[name=?]", "token[symbol]"

      assert_select "input[name=?]", "token[name]"

      assert_select "input[name=?]", "token[total_supply]"

      assert_select "input[name=?]", "token[decimals]"

      assert_select "input[name=?]", "token[transfer_fee]"
    end
  end
end
