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

Function setupRouter

api/ledger_api_test.go:68–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

66}
67
68func setupRouter(t *testing.T) (*gin.Engine, *ledgerforge.LedgerForge, error) {
69 t.Helper()
70
71 if testing.Short() {
72 t.Skip("skipping API integration tests in short mode")
73 }
74
75 config.MockConfig(&config.Configuration{
76 Queue: config.QueueConfig{
77 TransactionQueue: "transaction_queue_test_api_md_async",
78 NumberOfQueues: 1,
79 },
80 Redis: config.RedisConfig{Dns: "localhost:6379"},
81 DataSource: config.DataSourceConfig{Dns: "postgres://postgres:@localhost:5432/ledgerforge?sslmode=disable"},
82 })
83 cnf, err := config.Fetch()
84 if err != nil {
85 return nil, nil, err
86 }
87 db, err := database.NewDataSource(cnf)
88 if err != nil {
89 return nil, nil, err
90 }
91 newLedgerForge, err := ledgerforge.NewLedgerForge(db)
92 if err != nil {
93 return nil, nil, err
94 }
95 router := NewAPI(newLedgerForge).Router()
96
97 return router, newLedgerForge, nil
98}
99
100func TestCreateLedger(t *testing.T) {
101 router, ledgerforge, err := setupRouter(t)

Callers 15

TestRegisterHookFunction · 0.85
TestUpdateHookFunction · 0.85
TestGetHookFunction · 0.85
TestListHooksFunction · 0.85
TestDeleteHookFunction · 0.85
TestCreateLedgerFunction · 0.85
TestGetLedgerFunction · 0.85
TestStartReconciliationFunction · 0.85
TestGetReconciliationFunction · 0.85
TestCreateMatchingRuleFunction · 0.85
TestUpdateMatchingRuleFunction · 0.85

Calls 6

MockConfigFunction · 0.92
FetchFunction · 0.92
NewDataSourceFunction · 0.92
NewLedgerForgeFunction · 0.92
NewAPIFunction · 0.85
RouterMethod · 0.80

Tested by

no test coverage detected