mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 17:23:10 -05:00
Properly expose errors in ads and tests (#8692)
* add code to expose errors outside zone * remove unexpect error hiding * remove uncessary code * fix tests * trying to catch more errros * revert for testing * wip * wip * figured out what was going on * wip * fix tests * fix tests
This commit is contained in:
@@ -64,7 +64,7 @@ suite('ComponentBase Tests', () => {
|
||||
testContainer = new TestContainer(modelStore, 'testContainer');
|
||||
});
|
||||
|
||||
test('Component validation runs external validations stored in the model store', done => {
|
||||
test('Component validation runs external validations stored in the model store', () => {
|
||||
assert.equal(testComponent.valid, true, 'Test component validity did not default to true');
|
||||
let validationCalls = 0;
|
||||
modelStore.registerValidationCallback(componentId => {
|
||||
@@ -72,19 +72,14 @@ suite('ComponentBase Tests', () => {
|
||||
return Promise.resolve(false);
|
||||
});
|
||||
|
||||
testComponent.validate().then(valid => {
|
||||
try {
|
||||
assert.equal(validationCalls, 1, 'External validation was not called once');
|
||||
assert.equal(valid, false, 'Validate call did not return correct value from the external validation');
|
||||
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
|
||||
done();
|
||||
} catch (err) {
|
||||
done(err);
|
||||
}
|
||||
}, err => done(err));
|
||||
return testComponent.validate().then(valid => {
|
||||
assert.equal(validationCalls, 1, 'External validation was not called once');
|
||||
assert.equal(valid, false, 'Validate call did not return correct value from the external validation');
|
||||
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
|
||||
});
|
||||
});
|
||||
|
||||
test('Component validation runs default component validations', done => {
|
||||
test('Component validation runs default component validations', () => {
|
||||
assert.equal(testComponent.valid, true, 'Test component validity did not default to true');
|
||||
let validationCalls = 0;
|
||||
testComponent.addValidation(() => {
|
||||
@@ -92,29 +87,23 @@ suite('ComponentBase Tests', () => {
|
||||
return false;
|
||||
});
|
||||
|
||||
testComponent.validate().then(valid => {
|
||||
try {
|
||||
assert.equal(validationCalls, 1, 'Default validation was not called once');
|
||||
assert.equal(valid, false, 'Validate call did not return correct value from the default validation');
|
||||
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
|
||||
done();
|
||||
} catch (err) {
|
||||
done(err);
|
||||
}
|
||||
}, err => done(err));
|
||||
return testComponent.validate().then(valid => {
|
||||
assert.equal(validationCalls, 1, 'Default validation was not called once');
|
||||
assert.equal(valid, false, 'Validate call did not return correct value from the default validation');
|
||||
assert.equal(testComponent.valid, false, 'Validate call did not update the component valid property');
|
||||
});
|
||||
});
|
||||
|
||||
test('Container validation reflects child component validity', done => {
|
||||
test('Container validation reflects child component validity', () => {
|
||||
assert.equal(testContainer.valid, true, 'Test container validity did not default to true');
|
||||
testContainer.addToContainer(testComponent.descriptor, undefined);
|
||||
testComponent.addValidation(() => false);
|
||||
testComponent.validate().then(() => {
|
||||
testContainer.validate().then(valid => {
|
||||
return testComponent.validate().then(() => {
|
||||
return testContainer.validate().then(valid => {
|
||||
assert.equal(valid, false, 'Validate call did not return correct value for container child validation');
|
||||
assert.equal(testContainer.valid, false, 'Validate call did not update the container valid property');
|
||||
done();
|
||||
}, err => done(err));
|
||||
}, err => done(err));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test('Container child validity changes cause the parent container validity to change', done => {
|
||||
|
||||
Reference in New Issue
Block a user