mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-09-29 12:18:27 -04:00
add default veilid config to the api
This commit is contained in:
parent
31bb8018f6
commit
8818e63dc0
17 changed files with 242 additions and 126 deletions
|
@ -1624,3 +1624,8 @@ pub fn veilid_version() -> JsValue {
|
|||
};
|
||||
<JsValue as JsValueSerdeExt>::from_serde(&vv).unwrap()
|
||||
}
|
||||
|
||||
#[wasm_bindgen()]
|
||||
pub fn default_veilid_config() -> String {
|
||||
veilid_core::default_veilid_config()
|
||||
}
|
||||
|
|
|
@ -178,4 +178,9 @@ impl VeilidClient {
|
|||
pub fn versionString() -> String {
|
||||
veilid_core::veilid_version_string()
|
||||
}
|
||||
|
||||
/// Return the default veilid configuration in json string format.
|
||||
pub fn defaultConfig() -> String {
|
||||
veilid_core::default_veilid_config()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,19 @@ describe('veilidClient', () => {
|
|||
expect(version.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it('should get config string', async () => {
|
||||
const defaultConfig = veilidClient.defaultConfig();
|
||||
expect(typeof defaultConfig).toBe('string');
|
||||
expect(defaultConfig.length).toBeGreaterThan(0);
|
||||
|
||||
const cfgObject1 = JSON.parse(defaultConfig);
|
||||
const defaultConfigStr = JSON.stringify(cfgObject1);
|
||||
const cfgObject2 = JSON.parse(defaultConfigStr);
|
||||
const defaultConfigStr2 = JSON.stringify(cfgObject2);
|
||||
|
||||
expect(defaultConfigStr).toEqual(defaultConfigStr2);
|
||||
});
|
||||
|
||||
it('should attach and detach', async () => {
|
||||
await veilidClient.attach();
|
||||
await waitForMs(2000);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue