"use strict";
var __webpack_exports__ = {};
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
require("react");
const client_namespaceObject = require("@tachybase/test/client");
const external_vitest_namespaceObject = require("vitest");
const external_Application_js_namespaceObject = require("../Application.js");
const index_js_namespaceObject = require("../hooks/index.js");
const external_Plugin_js_namespaceObject = require("../Plugin.js");
function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
(0, external_vitest_namespaceObject.describe)('Application Hooks', ()=>{
    (0, external_vitest_namespaceObject.describe)('useApp()', ()=>{
        it('should return the application instance', async ()=>{
            const app = new external_Application_js_namespaceObject.Application();
            const Hello = ()=>{
                const app1 = (0, index_js_namespaceObject.useApp)();
                expect(app).toBe(app1);
                return null;
            };
            app.addProviders([
                Hello
            ]);
            const Root = app.getRootComponent();
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Root, {}));
            await (0, client_namespaceObject.sleep)(10);
        });
    });
    (0, external_vitest_namespaceObject.describe)('useRouter()', ()=>{
        it('should return the router instance', async ()=>{
            const app = new external_Application_js_namespaceObject.Application();
            const Hello = ()=>{
                const router = (0, index_js_namespaceObject.useRouter)();
                expect(app.router).toBe(router);
                return null;
            };
            app.addProviders([
                Hello
            ]);
            const Root = app.getRootComponent();
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Root, {}));
            await (0, client_namespaceObject.sleep)(10);
        });
    });
    (0, external_vitest_namespaceObject.describe)('usePlugin()', ()=>{
        it('should return the plugin instance', async ()=>{
            class DemoPlugin extends external_Plugin_js_namespaceObject.Plugin {
                constructor(...args){
                    super(...args), _define_property(this, "test", 'test');
                }
            }
            const Hello = ()=>{
                const demo = (0, index_js_namespaceObject.usePlugin)('demo');
                const demo2 = (0, index_js_namespaceObject.usePlugin)(DemoPlugin);
                expect(demo).toBeInstanceOf(DemoPlugin);
                expect(demo2).toBeInstanceOf(DemoPlugin);
                expect(demo.test).toBe('test');
                expect(demo2.test).toBe('test');
                return null;
            };
            const app = new external_Application_js_namespaceObject.Application({
                plugins: [
                    [
                        DemoPlugin,
                        {
                            name: 'demo'
                        }
                    ]
                ],
                providers: [
                    Hello
                ]
            });
            const Root = app.getRootComponent();
            (0, client_namespaceObject.render)(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Root, {}));
            await (0, client_namespaceObject.sleep)(10);
        });
    });
});
var __webpack_export_target__ = exports;
for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
    value: true
});
