(t *testing.T)
| 419 | } |
| 420 | |
| 421 | func TestDetokenizeIdentity_Empty(t *testing.T) { |
| 422 | datasource, mock, err := newTestDataSource() |
| 423 | if err != nil { |
| 424 | t.Fatalf("Error creating test data source: %s", err) |
| 425 | } |
| 426 | |
| 427 | d, err := NewLedgerForge(datasource) |
| 428 | if err != nil { |
| 429 | t.Fatalf("Error creating LedgerForge instance: %s", err) |
| 430 | } |
| 431 | |
| 432 | testID := "idt_123" |
| 433 | |
| 434 | mock.ExpectBegin() |
| 435 | row := sqlmock.NewRows([]string{ |
| 436 | "identity_id", "identity_type", "first_name", "last_name", "other_names", "gender", "dob", |
| 437 | "email_address", "phone_number", "nationality", "organization_name", "category", |
| 438 | "street", "country", "state", "post_code", "city", "created_at", "meta_data", |
| 439 | }).AddRow( |
| 440 | testID, "Individual", "John", "Doe", "Other", "Male", time.Now(), |
| 441 | "john@example.com", "1234567890", "US", "Org", "Cat", |
| 442 | "Street", "Country", "State", "12345", "City", time.Now(), `{}`, |
| 443 | ) |
| 444 | mock.ExpectQuery("SELECT .* FROM ledgerforge.identity WHERE identity_id ="). |
| 445 | WithArgs(testID). |
| 446 | WillReturnRows(row) |
| 447 | mock.ExpectCommit() |
| 448 | |
| 449 | result, err := d.DetokenizeIdentity(testID) |
| 450 | assert.NoError(t, err) |
| 451 | assert.Empty(t, result) |
| 452 | |
| 453 | if err := mock.ExpectationsWereMet(); err != nil { |
| 454 | t.Errorf("there were unfulfilled expectations: %s", err) |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | func TestTokenizeAllPII(t *testing.T) { |
| 459 | datasource, mock, err := newTestDataSource() |
nothing calls this directly
no test coverage detected