Skip to content

Commit b7bee8c

Browse files
committed
add test
1 parent f911037 commit b7bee8c

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

packages/compass-schema-validation/src/components/validation-editor.spec.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,34 @@ describe('ValidationEditor [Component]', function () {
102102
});
103103

104104
context('when the validator is empty', function () {
105+
let onGenerateRulesSpy: sinon.SinonSpy;
106+
beforeEach(async function () {
107+
onGenerateRulesSpy = sinon.spy();
108+
await renderValidationEditor({
109+
generateValidationRules: onGenerateRulesSpy,
110+
isEditable: true,
111+
validation: {
112+
validator: '',
113+
validationAction: 'error',
114+
validationLevel: 'moderate',
115+
isChanged: false,
116+
syntaxError: null,
117+
error: null,
118+
},
119+
});
120+
});
121+
122+
it('allows to generate rules', function () {
123+
const generateBtn = screen.getByRole('button', {
124+
name: 'Generate rules',
125+
});
126+
expect(generateBtn).to.be.visible;
127+
userEvent.click(generateBtn);
128+
expect(onGenerateRulesSpy).to.have.been.calledOnce;
129+
});
130+
});
131+
132+
context('when the validator is empty object', function () {
105133
let onGenerateRulesSpy: sinon.SinonSpy;
106134
beforeEach(async function () {
107135
onGenerateRulesSpy = sinon.spy();

0 commit comments

Comments
 (0)