Skip to content

Commit 0543756

Browse files
committed
some debug stuff
1 parent da34660 commit 0543756

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

lib/nbn/resources/cvc.ex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ defmodule DiffoExample.Nbn.Cvc do
134134
public? true
135135
end
136136

137+
exists :cvc_svlan_set?, :characteristics do
138+
description "true when the CVC characteristic has an svlan value set"
139+
filter expr(name == :cvc and not is_nil(value.value.value.svlan))
140+
public? true
141+
end
142+
137143
first :cvc_char_value, :characteristics, :value do
138144
description "the deserialized CvcValue typed struct from the CVC characteristic"
139145
filter expr(name == :cvc)

test/nbn/aggregates_test.exs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ defmodule DiffoExample.Nbn.AggregatesTest do
5656
refute is_nil(cvc.svlan_assigned?)
5757
end
5858

59+
@tag skip: "https://github.com/diffo-dev/diffo/issues/125"
60+
test "cvc_svlan_set? is false before define, true after" do
61+
{:ok, cvc} = Nbn.build_cvc(%{})
62+
63+
cvc = Ash.load!(cvc, [:cvc_svlan_set?])
64+
refute cvc.cvc_svlan_set?
65+
66+
{:ok, cvc} =
67+
Nbn.define_cvc(cvc, %{
68+
characteristic_value_updates: [cvc: [svlan: 100, bandwidth: 1000]]
69+
})
70+
71+
cvc = Ash.load!(cvc, [:cvc_svlan_set?])
72+
assert cvc.cvc_svlan_set?
73+
end
74+
5975
test "cvc_char_value returns a fully deserialized CvcValue struct" do
6076
{:ok, cvc} = Nbn.build_cvc(%{})
6177

test/nbn/raw_inspect_test.exs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# SPDX-FileCopyrightText: 2025 diffo_example contributors <https://github.com/diffo-dev/diffo_example/graphs.contributors>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
5+
defmodule DiffoExample.Nbn.RawInspectTest do
6+
@moduledoc false
7+
use ExUnit.Case, async: false
8+
9+
alias DiffoExample.Nbn
10+
11+
setup do
12+
on_exit(fn -> AshNeo4j.Neo4jHelper.delete_all() end)
13+
end
14+
15+
@tag skip: "https://github.com/diffo-dev/diffo/issues/125"
16+
test "inspect raw characteristic value stored in Neo4j" do
17+
{:ok, cvc} = Nbn.build_cvc(%{})
18+
19+
{:ok, _cvc} =
20+
Nbn.define_cvc(cvc, %{
21+
characteristic_value_updates: [cvc: [svlan: 42, bandwidth: 5000]]
22+
})
23+
24+
{:ok, result} = AshNeo4j.Neo4jHelper.read_nodes(:Characteristic)
25+
IO.inspect(result, label: "raw Characteristic nodes", pretty: true)
26+
Process.sleep(30_000)
27+
end
28+
end

0 commit comments

Comments
 (0)