Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
findolor committed Feb 25, 2025
1 parent 1d1c83a commit 0e76909
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/settings/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ impl PartialEq for GuiDeploymentCfg {

#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[cfg_attr(target_family = "wasm", derive(Tsify))]
#[serde(rename_all = "camelCase")]
pub struct GuiFieldDefinitionCfg {
pub binding: String,
pub name: String,
Expand Down
3 changes: 3 additions & 0 deletions packages/orderbook/test/js_api/gui.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ gui:
- value: "99.2"
- value: "582.1"
- value: "648.239"
show-custom-field: true
other-deployment:
name: Test test
description: Test test test
Expand Down Expand Up @@ -759,6 +760,7 @@ describe('Rain Orderbook JS API Package Bindgen Tests - Gui', async function ()
assert.equal(fieldDefinition.description, 'Field 1 description');
assert.equal(fieldDefinition.presets?.length, 3);
assert.equal(fieldDefinition.default, 'some-default-value');
assert.equal(fieldDefinition.showCustomField, undefined);

let presets = fieldDefinition.presets as GuiPresetCfg[];
assert.equal(presets[0].name, 'Preset 1');
Expand All @@ -774,6 +776,7 @@ describe('Rain Orderbook JS API Package Bindgen Tests - Gui', async function ()
assert.equal(presets[1].value, '582.1');
assert.equal(presets[2].value, '648.239');
assert.equal(fieldDefinition2.default, undefined);
assert.equal(fieldDefinition2.showCustomField, true);
});

it('should throw error during get if field binding is not found', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('FieldDefinitionInput', () => {
it('handles custom input changes and triggers state update', async () => {
const { getByPlaceholderText } = render(FieldDefinitionInput, {
props: {
fieldDefinition: mockFieldDefinition,
fieldDefinition: { ...mockFieldDefinition, showCustomField: true },
gui: mockGui
}
});
Expand Down Expand Up @@ -114,7 +114,11 @@ describe('FieldDefinitionInput', () => {
it('renders default value if it exists', async () => {
const { getByPlaceholderText } = render(FieldDefinitionInput, {
props: {
fieldDefinition: { ...mockFieldDefinition, default: 'default value' },
fieldDefinition: {
...mockFieldDefinition,
default: 'default value',
showCustomField: true
},
gui: mockGui
}
});
Expand Down

0 comments on commit 0e76909

Please sign in to comment.