Skip to content

Node field type [uid] doesn't work through Repo  #83

Description

@mangr3n

Maybe I'm not understanding how this is supposed to work, but this doesn't work

test "setting uid fields" do
  user = %User{name: "George", age: 52}
  assert {:ok, %User{uid: uid}} = TestRepo.set(user)

  friend = %User{name: "David", age: 48, friends: [uid]}
  assert {:ok, %User{uid: new_uid}} = TestRepo.set(friend)
end

test "setting uid fields in changeset" do
  changeset = Ecto.Changeset.cast(%User{}, %{name: "George", age: 52}, [:name, :age])
  assert {:ok, %User{uid: uid}} = TestRepo.set(changeset)


  friendset = Ecto.Changeset.cast(%User{}, %{name: "David", age: 48, friends: [uid]}, [:name, :age, :friends])
  assert {:ok, %User{uid: new_uid}} = TestRepo.set(friendset)
end

Errors:

  1. test schema operations setting uid fields (Dlex.RepoTest)
    test/dlex/repo_test.exs:39
    match (=) failed
    code: assert {:ok, %User{uid: new_uid}} = TestRepo.set(friend)
    left: {:ok, %Dlex.User{uid: new_uid}}
    right: {:error, %Dlex.Error{exception: true, action: :execute, reason: %GRPC.RPCError{message: "Input for predicate "user.friends" of type uid is scalar. Edge: entity:11063 attr:"user.friends" value:"0x2b36" value_type:STRING ", status: 2}}}
    stacktrace:
    test/dlex/repo_test.exs:44: (test)

  2. test schema operations setting uid fields (Dlex.RepoTest)
    test/dlex/repo_test.exs:39
    match (=) failed
    code: assert {:ok, %User{uid: new_uid}} = TestRepo.set(friend)
    left: {:ok, %Dlex.User{uid: new_uid}}
    right: {:error, %Dlex.Error{exception: true, action: :execute, reason: %GRPC.RPCError{message: "Input for predicate "user.friends" of type uid is scalar. Edge: entity:11092 attr:"user.friends" value:"0x2b53" value_type:STRING ", status: 2}}}
    stacktrace:
    test/dlex/repo_test.exs:44: (test)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions