MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestGetIdentityIdentifier

Function TestGetIdentityIdentifier

lineage_test.go:175–223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestGetIdentityIdentifier(t *testing.T) {
176 datasource, _, err := newTestDataSource()
177 if err != nil {
178 t.Fatalf("Error creating test data source: %s", err)
179 }
180
181 ledgerforge, err := NewLedgerForge(datasource)
182 if err != nil {
183 t.Fatalf("Error creating LedgerForge instance: %s", err)
184 }
185
186 tests := []struct {
187 name string
188 identity *model.Identity
189 expected string
190 }{
191 {
192 name: "Individual with first and last name",
193 identity: &model.Identity{
194 IdentityID: "idt_123",
195 FirstName: "Alice",
196 LastName: "Smith",
197 },
198 expected: "alice_smith_idt_123",
199 },
200 {
201 name: "Organization",
202 identity: &model.Identity{
203 IdentityID: "idt_456",
204 OrganizationName: "Acme Corp",
205 },
206 expected: "acme_corp_idt_456",
207 },
208 {
209 name: "Fallback to ID",
210 identity: &model.Identity{
211 IdentityID: "idt_789",
212 },
213 expected: "idt_789",
214 },
215 }
216
217 for _, tt := range tests {
218 t.Run(tt.name, func(t *testing.T) {
219 result := ledgerforge.getIdentityIdentifier(tt.identity)
220 assert.Equal(t, tt.expected, result)
221 })
222 }
223}
224
225func TestSequentialAllocation_FIFO(t *testing.T) {
226 datasource, _, err := newTestDataSource()

Callers

nothing calls this directly

Calls 3

getIdentityIdentifierMethod · 0.95
newTestDataSourceFunction · 0.85
NewLedgerForgeFunction · 0.85

Tested by

no test coverage detected