-- Copyright (c) 2026 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
local lu = require 'luaunit'

local storage_bus = require 'storage_bus'
local storage_db = require 'storage_db'

TestStorageBusDb = {}

function TestStorageBusDb:test_storage_bus_new_uses_app_bus()
    local app = { bus = 'BUS_OBJ' }
    local b1 = storage_bus.new(app)
    lu.assertEquals(b1.bus, 'BUS_OBJ')
end

function TestStorageBusDb:test_storage_db_new_uses_app_db_and_reset()
    local app = {
        db = 'DB_OBJ',
        reset_local_db = function() return 'reset_called' end
    }
    local d1 = storage_db.new(app)
    lu.assertEquals(d1.db, 'DB_OBJ')
    lu.assertNotNil(d1.reset_local_db)
    lu.assertEquals(d1.reset_local_db(), 'reset_called')
end

