Replace deprecated assert functions in test files. (#16945)

This commit is contained in:
Cory Rivera
2021-08-31 09:04:17 -07:00
committed by GitHub
parent de3ff30398
commit 0082031f97
79 changed files with 1960 additions and 1965 deletions

View File

@@ -43,7 +43,7 @@ suite('Account Management Dialog Controller Tests', () => {
controller.openAccountDialog();
// Then: It should be the same dialog that already existed
assert.equal(controller.accountDialog, accountDialog);
assert.strictEqual(controller.accountDialog, accountDialog);
});
test('Add Account Failure - Error Message Shown', () => {

View File

@@ -134,8 +134,8 @@ suite('Assessment Actions', () => {
const connectionManagementService = createConnectionManagementService(dbListResult);
const action = new AsmtServerSelectItemsAction(connectionManagementService.object, new NullLogService(), mockAssessmentService.object, new NullAdsTelemetryService());
assert.equal(action.id, AsmtServerSelectItemsAction.ID, 'Get Server Rules id action mismatch');
assert.equal(action.label, AsmtServerSelectItemsAction.LABEL, 'Get Server Rules label action mismatch');
assert.strictEqual(action.id, AsmtServerSelectItemsAction.ID, 'Get Server Rules id action mismatch');
assert.strictEqual(action.label, AsmtServerSelectItemsAction.LABEL, 'Get Server Rules label action mismatch');
await action.run({ ownerUri: '', component: mockAsmtViewComponent.object, connectionId: '' });
mockAsmtViewComponent.verify(s => s.showProgress(AssessmentType.AvailableRules), TypeMoq.Times.once());
@@ -157,8 +157,8 @@ suite('Assessment Actions', () => {
const connectionManagementService = createConnectionManagementService(dbListResult);
const action = new AsmtServerInvokeItemsAction(connectionManagementService.object, new NullLogService(), mockAssessmentService.object, new NullAdsTelemetryService());
assert.equal(action.id, AsmtServerInvokeItemsAction.ID, 'Invoke Server Assessment id action mismatch');
assert.equal(action.label, AsmtServerInvokeItemsAction.LABEL, 'Invoke Server Assessment label action mismatch');
assert.strictEqual(action.id, AsmtServerInvokeItemsAction.ID, 'Invoke Server Assessment id action mismatch');
assert.strictEqual(action.label, AsmtServerInvokeItemsAction.LABEL, 'Invoke Server Assessment label action mismatch');
await action.run({ ownerUri: '', component: mockAsmtViewComponent.object, connectionId: '' });
mockAsmtViewComponent.verify(s => s.showProgress(AssessmentType.InvokeAssessment), TypeMoq.Times.once());
@@ -173,7 +173,7 @@ suite('Assessment Actions', () => {
test('Get Assessment Items Database Action', async () => {
const action = new AsmtDatabaseSelectItemsAction('databaseName', mockAssessmentService.object, new NullAdsTelemetryService());
assert.equal(action.id, AsmtDatabaseSelectItemsAction.ID, 'Get Database Rules id action mismatch');
assert.strictEqual(action.id, AsmtDatabaseSelectItemsAction.ID, 'Get Database Rules id action mismatch');
await action.run({ ownerUri: '', component: mockAsmtViewComponent.object, connectionId: '' });
mockAsmtViewComponent.verify(s => s.showProgress(AssessmentType.AvailableRules), TypeMoq.Times.once());
@@ -185,7 +185,7 @@ suite('Assessment Actions', () => {
test('Invoke Database Assessment Action', async () => {
const action = new AsmtDatabaseInvokeItemsAction('databaseName', mockAssessmentService.object, new NullAdsTelemetryService());
assert.equal(action.id, AsmtDatabaseInvokeItemsAction.ID, 'Invoke Database Assessment id action mismatch');
assert.strictEqual(action.id, AsmtDatabaseInvokeItemsAction.ID, 'Invoke Database Assessment id action mismatch');
await action.run({ ownerUri: '', component: mockAsmtViewComponent.object, connectionId: '' });
mockAsmtViewComponent.verify(s => s.showProgress(AssessmentType.InvokeAssessment), TypeMoq.Times.once());
@@ -197,8 +197,8 @@ suite('Assessment Actions', () => {
test('Generate Script Action', async () => {
const action = new AsmtExportAsScriptAction(mockAssessmentService.object, new NullAdsTelemetryService());
assert.equal(action.id, AsmtExportAsScriptAction.ID, 'Generate Assessment script id action mismatch');
assert.equal(action.label, AsmtExportAsScriptAction.LABEL, 'Generate Assessment script label action mismatch');
assert.strictEqual(action.id, AsmtExportAsScriptAction.ID, 'Generate Assessment script id action mismatch');
assert.strictEqual(action.label, AsmtExportAsScriptAction.LABEL, 'Generate Assessment script label action mismatch');
await action.run({ ownerUri: '', component: mockAsmtViewComponent.object, connectionId: '' });
mockAssessmentService.verify(s => s.generateAssessmentScript(TypeMoq.It.isAnyString(), TypeMoq.It.isAny()), TypeMoq.Times.once());
@@ -209,8 +209,8 @@ suite('Assessment Actions', () => {
openerService.setup(s => s.open(TypeMoq.It.isAny())).returns(() => Promise.resolve(true));
const action = new AsmtSamplesLinkAction(openerService.object, new NullAdsTelemetryService());
assert.equal(action.id, AsmtSamplesLinkAction.ID, 'Samples Link id action mismatch');
assert.equal(action.label, AsmtSamplesLinkAction.LABEL, 'Samples Link label action mismatch');
assert.strictEqual(action.id, AsmtSamplesLinkAction.ID, 'Samples Link id action mismatch');
assert.strictEqual(action.label, AsmtSamplesLinkAction.LABEL, 'Samples Link label action mismatch');
await action.run();
openerService.verify(s => s.open(TypeMoq.It.isAny()), TypeMoq.Times.once());
@@ -251,8 +251,8 @@ suite('Assessment Actions', () => {
new NullAdsTelemetryService(),
notificationService.object,
fileDialogService);
assert.equal(action.id, AsmtGenerateHTMLReportAction.ID, 'Generate HTML Report id action mismatch');
assert.equal(action.label, AsmtGenerateHTMLReportAction.LABEL, 'Generate HTML Report label action mismatch');
assert.strictEqual(action.id, AsmtGenerateHTMLReportAction.ID, 'Generate HTML Report id action mismatch');
assert.strictEqual(action.label, AsmtGenerateHTMLReportAction.LABEL, 'Generate HTML Report label action mismatch');
await action.run({ ownerUri: '', component: mockAsmtViewComponent.object, connectionId: '' });
notificationService.verify(s => s.prompt(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()), TypeMoq.Times.once());

View File

@@ -150,7 +150,7 @@ suite('commandLineService tests', () => {
let contribution = getCommandLineContribution(connectionManagementService.object, configurationService.object);
return contribution.processCommandLine(new TestParsedArgs()).then(() => {
connectionManagementService.verifyAll();
}, error => { assert.fail(error, null, 'processCommandLine rejected ' + error); });
}, error => { assert.fail('processCommandLine rejected ' + error); });
});
test('processCommandLine does nothing if no server name and command name is provided and the configuration \'workbench.showConnectDialogOnStartup\' is set to false, even if registered servers exist', async () => {
@@ -183,7 +183,7 @@ suite('commandLineService tests', () => {
await contribution.processCommandLine(new TestParsedArgs());
connectionManagementService.verifyAll();
} catch (error) {
assert.fail(error, null, 'processCommandLine rejected ' + error);
assert.fail('processCommandLine rejected ' + error);
}
});
@@ -275,7 +275,7 @@ suite('commandLineService tests', () => {
connectionManagementService.verifyAll();
commandService.verifyAll();
assert(!isUndefinedOrNull(actualProfile));
assert.equal(actualProfile.connectionProfile.serverName, args.server);
assert.strictEqual(actualProfile.connectionProfile.serverName, args.server);
});
@@ -433,7 +433,7 @@ suite('commandLineService tests', () => {
let result = await contribution.handleURL(uri);
// Then I expect connection management service to have been called
assert.equal(result, false, 'Expected URL to be ignored');
assert.strictEqual(result, false, 'Expected URL to be ignored');
});
test('handleUrl opens a new connection if a server name is passed', async () => {
@@ -463,7 +463,7 @@ suite('commandLineService tests', () => {
let result = await contribution.handleURL(uri);
// Then I expect connection management service to have been called
assert.equal(result, true, 'Expected URL to be handled');
assert.strictEqual(result, true, 'Expected URL to be handled');
connectionManagementService.verifyAll();
});
@@ -495,7 +495,7 @@ suite('commandLineService tests', () => {
let result = await contribution.handleURL(uri);
// Then I expect no connection, but the URL should still be handled
assert.equal(result, true, 'Expected URL to be handled');
assert.strictEqual(result, true, 'Expected URL to be handled');
connectionManagementService.verifyAll();
});
@@ -522,7 +522,7 @@ suite('commandLineService tests', () => {
let result = await contribution.handleURL(uri);
// Then command service should not have been called, and instead connection should be handled
assert.equal(result, true);
assert.strictEqual(result, true);
commandService.verifyAll();
notificationService.verifyAll();
});
@@ -559,7 +559,7 @@ suite('commandLineService tests', () => {
let result = await contribution.handleURL(uri);
// Then command service should not have been called, and instead connection should be handled
assert.equal(result, true);
assert.strictEqual(result, true);
commandService.verifyAll();
notificationService.verifyAll();
connectionManagementService.verifyAll();

View File

@@ -99,6 +99,6 @@ suite('Advanced properties dialog tests', () => {
});
advancedController.advancedDialog = advanceDialog.object;
advancedController.showDialog(providerOptions, options);
assert.equal(isAdvancedDialogCalled, true);
assert.strictEqual(isAdvancedDialogCalled, true);
});
});

View File

@@ -66,7 +66,7 @@ suite('Explorer Widget Tests', () => {
// Then the resulting list is sorted by type, with Table > View > Stored Procedures > Function, then by name
let expectedList = [testMetadata[1], testMetadata[4], testMetadata[0], testMetadata[2], testMetadata[3]];
expectedList.forEach((expectedWrapper, index) => assert.equal(sortedMetadata[index], expectedWrapper));
expectedList.forEach((expectedWrapper, index) => assert.strictEqual(sortedMetadata[index], expectedWrapper));
});
test('Filter is only performed on the specified properties', () => {
@@ -83,8 +83,8 @@ suite('Explorer Widget Tests', () => {
obj2[prop2] = 'Match';
obj2[prop3] = 'cd';
const result = filter.filter('ATc', [obj1, obj2]);
assert.equal(result.length, 1, 'filtered result set should container 1 item');
assert.equal(result[0], obj2, 'filtered result set does not match expectation');
assert.strictEqual(result.length, 1, 'filtered result set should container 1 item');
assert.strictEqual(result[0], obj2, 'filtered result set does not match expectation');
});
test('object type filter', () => {
@@ -137,41 +137,41 @@ suite('Explorer Widget Tests', () => {
].map(o => new ObjectMetadataWrapper(o));
const filter = new ExplorerFilter('database', ['name']);
let result = filter.filter('t:', testMetadata);
assert.equal(result.length, 1, 'table type filter should return only 1 item');
assert.equal(result[0]['name'], 'testTable', 'table type filter does not return correct data');
assert.strictEqual(result.length, 1, 'table type filter should return only 1 item');
assert.strictEqual(result[0]['name'], 'testTable', 'table type filter does not return correct data');
result = filter.filter('v:', testMetadata);
assert.equal(result.length, 2, 'view type filter should return only 1 item');
assert.equal(result[0]['name'], 'testView', 'view type filter does not return correct data');
assert.equal(result[1]['name'], 'firstView', 'view type filter does not return correct data');
assert.strictEqual(result.length, 2, 'view type filter should return only 1 item');
assert.strictEqual(result[0]['name'], 'testView', 'view type filter does not return correct data');
assert.strictEqual(result[1]['name'], 'firstView', 'view type filter does not return correct data');
result = filter.filter('sp:', testMetadata);
assert.equal(result.length, 1, 'stored proc type filter should return only 1 item');
assert.equal(result[0]['name'], 'testSProc', 'stored proc type filter does not return correct data');
assert.strictEqual(result.length, 1, 'stored proc type filter should return only 1 item');
assert.strictEqual(result[0]['name'], 'testSProc', 'stored proc type filter does not return correct data');
result = filter.filter('f:', testMetadata);
assert.equal(result.length, 1, 'function type filter should return only 1 item');
assert.equal(result[0]['name'], 'testFunction', 'function type filter does not return correct data');
assert.strictEqual(result.length, 1, 'function type filter should return only 1 item');
assert.strictEqual(result[0]['name'], 'testFunction', 'function type filter does not return correct data');
result = filter.filter('v:first', testMetadata);
assert.equal(result.length, 1, 'view type and name filter should return only 1 item');
assert.equal(result[0]['name'], 'firstView', 'view type and name filter does not return correct data');
assert.strictEqual(result.length, 1, 'view type and name filter should return only 1 item');
assert.strictEqual(result[0]['name'], 'firstView', 'view type and name filter does not return correct data');
});
test('Icon css class test', () => {
const serverView = new ExplorerView('server');
let icon = serverView.getIconClass({});
assert.equal(icon, 'database-colored');
assert.strictEqual(icon, 'database-colored');
const databaseView = new ExplorerView('database');
const obj = {};
obj['metadataType'] = MetadataType.Function;
icon = databaseView.getIconClass(obj);
assert.equal(icon, 'scalarvaluedfunction');
assert.strictEqual(icon, 'scalarvaluedfunction');
obj['metadataType'] = MetadataType.SProc;
icon = databaseView.getIconClass(obj);
assert.equal(icon, 'storedprocedure');
assert.strictEqual(icon, 'storedprocedure');
obj['metadataType'] = MetadataType.Table;
icon = databaseView.getIconClass(obj);
assert.equal(icon, 'table');
assert.strictEqual(icon, 'table');
obj['metadataType'] = MetadataType.View;
icon = databaseView.getIconClass(obj);
assert.equal(icon, 'view');
assert.strictEqual(icon, 'view');
});
test('explorer property list', () => {
@@ -201,19 +201,19 @@ suite('Explorer Widget Tests', () => {
}]
};
let propertyList = serverView.getPropertyList(emptyFlavor);
assert.equal(propertyList.length, 1, 'default database property list should contain 1 property');
assert.equal(propertyList[0].value, 'name', 'default database property list should contain name property');
assert.strictEqual(propertyList.length, 1, 'default database property list should contain 1 property');
assert.strictEqual(propertyList[0].value, 'name', 'default database property list should contain name property');
propertyList = serverView.getPropertyList(flavor);
assert.equal(propertyList.length, 1, 'database property list should contain 1 property');
assert.equal(propertyList[0].value, 'dbprop1', 'database property list should contain dbprop1 property');
assert.strictEqual(propertyList.length, 1, 'database property list should contain 1 property');
assert.strictEqual(propertyList[0].value, 'dbprop1', 'database property list should contain dbprop1 property');
const databaseView = new ExplorerView('database');
propertyList = databaseView.getPropertyList(emptyFlavor);
assert.equal(propertyList.length, 3, 'default object property list should contain 3 property');
assert.equal(propertyList[0].value, 'name', 'default object property list should contain name property');
assert.equal(propertyList[1].value, 'schema', 'default object property list should contain schema property');
assert.equal(propertyList[2].value, 'metadataTypeName', 'default object property list should contain metadataTypeName property');
assert.strictEqual(propertyList.length, 3, 'default object property list should contain 3 property');
assert.strictEqual(propertyList[0].value, 'name', 'default object property list should contain name property');
assert.strictEqual(propertyList[1].value, 'schema', 'default object property list should contain schema property');
assert.strictEqual(propertyList[2].value, 'metadataTypeName', 'default object property list should contain metadataTypeName property');
propertyList = databaseView.getPropertyList(flavor);
assert.equal(propertyList.length, 1, 'object property list should contain 1 property');
assert.equal(propertyList[0].value, 'objprop1', 'object property list should contain objprop1 property');
assert.strictEqual(propertyList.length, 1, 'object property list should contain 1 property');
assert.strictEqual(propertyList[0].value, 'objprop1', 'object property list should contain objprop1 property');
});
});

View File

@@ -107,9 +107,9 @@ suite('Dashboard Properties Widget Tests', () => {
// because config parsing is done async we need to put our asserts on the thread stack
setImmediate(() => {
const propertyItems: PropertyItem[] = (testComponent as any).parseProperties(databaseInfo);
assert.equal(propertyItems.length, 1);
assert.equal(propertyItems[0].displayName, 'Test');
assert.equal(propertyItems[0].value, 'Test Property');
assert.strictEqual(propertyItems.length, 1);
assert.strictEqual(propertyItems[0].displayName, 'Test');
assert.strictEqual(propertyItems[0].value, 'Test Property');
resolve();
});
});

View File

@@ -54,6 +54,6 @@ suite('Data Explorer Viewlet', () => {
let retrieved = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet('dataExplorer-test-id');
assert(d === retrieved);
let newCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
assert.equal(oldCount + 1, newCount);
assert.strictEqual(oldCount + 1, newCount);
});
});

View File

@@ -85,8 +85,8 @@ suite('Job Management Actions', () => {
mockRefreshAction.setup(s => s.run(TypeMoq.It.isAny())).returns(() => mockJobsViewComponent.object.refreshJobs());
mockRefreshAction.setup(s => s.id).returns(() => JobsRefreshAction.ID);
mockRefreshAction.setup(s => s.label).returns(() => JobsRefreshAction.LABEL);
assert.equal(mockRefreshAction.object.id, JobsRefreshAction.ID);
assert.equal(mockRefreshAction.object.label, JobsRefreshAction.LABEL);
assert.strictEqual(mockRefreshAction.object.id, JobsRefreshAction.ID);
assert.strictEqual(mockRefreshAction.object.label, JobsRefreshAction.LABEL);
// Job Refresh Action from Jobs View should refresh the component
await mockRefreshAction.object.run(null);
@@ -98,8 +98,8 @@ suite('Job Management Actions', () => {
mockNewJobAction.setup(s => s.run(TypeMoq.It.isAny())).returns(() => mockJobsViewComponent.object.openCreateJobDialog());
mockNewJobAction.setup(s => s.id).returns(() => NewJobAction.ID);
mockNewJobAction.setup(s => s.label).returns(() => NewJobAction.LABEL);
assert.equal(mockNewJobAction.object.id, NewJobAction.ID);
assert.equal(mockNewJobAction.object.label, NewJobAction.LABEL);
assert.strictEqual(mockNewJobAction.object.id, NewJobAction.ID);
assert.strictEqual(mockNewJobAction.object.label, NewJobAction.LABEL);
// New Job Action from Jobs View should open a dialog
await mockNewJobAction.object.run(null);
@@ -111,8 +111,8 @@ suite('Job Management Actions', () => {
mockEditJobAction.setup(s => s.run(TypeMoq.It.isAny()));
mockEditJobAction.setup(s => s.id).returns(() => EditJobAction.ID);
mockEditJobAction.setup(s => s.label).returns(() => EditJobAction.LABEL);
assert.equal(mockEditJobAction.object.id, EditJobAction.ID);
assert.equal(mockEditJobAction.object.label, EditJobAction.LABEL);
assert.strictEqual(mockEditJobAction.object.id, EditJobAction.ID);
assert.strictEqual(mockEditJobAction.object.label, EditJobAction.LABEL);
// Edit Job Action from Jobs View should open a dialog
await mockEditJobAction.object.run(null);
@@ -127,8 +127,8 @@ suite('Job Management Actions', () => {
mockRunJobAction.setup(s => s.id).returns(() => RunJobAction.ID);
mockRunJobAction.setup(s => s.label).returns(() => RunJobAction.LABEL);
assert.equal(mockRunJobAction.object.id, RunJobAction.ID);
assert.equal(mockRunJobAction.object.label, RunJobAction.LABEL);
assert.strictEqual(mockRunJobAction.object.id, RunJobAction.ID);
assert.strictEqual(mockRunJobAction.object.label, RunJobAction.LABEL);
// Run Job Action should make the Job Management service call job action
await mockRunJobAction.object.run(null);
@@ -143,8 +143,8 @@ suite('Job Management Actions', () => {
mockStopJobAction.setup(s => s.id).returns(() => RunJobAction.ID);
mockStopJobAction.setup(s => s.label).returns(() => RunJobAction.LABEL);
assert.equal(mockStopJobAction.object.id, RunJobAction.ID);
assert.equal(mockStopJobAction.object.label, RunJobAction.LABEL);
assert.strictEqual(mockStopJobAction.object.id, RunJobAction.ID);
assert.strictEqual(mockStopJobAction.object.label, RunJobAction.LABEL);
// Run Job Action should make the Job Management service call job action
await mockStopJobAction.object.run(null);
@@ -159,8 +159,8 @@ suite('Job Management Actions', () => {
mockDeleteJobAction.setup(s => s.id).returns(() => DeleteJobAction.ID);
mockDeleteJobAction.setup(s => s.label).returns(() => DeleteJobAction.LABEL);
assert.equal(mockDeleteJobAction.object.id, DeleteJobAction.ID);
assert.equal(mockDeleteJobAction.object.label, DeleteJobAction.LABEL);
assert.strictEqual(mockDeleteJobAction.object.id, DeleteJobAction.ID);
assert.strictEqual(mockDeleteJobAction.object.label, DeleteJobAction.LABEL);
// Run Job Action should make the Job Management service call job action
await mockDeleteJobAction.object.run(null);
@@ -173,8 +173,8 @@ suite('Job Management Actions', () => {
mockNewStepAction.setup(s => s.run(TypeMoq.It.isAny()));
mockNewStepAction.setup(s => s.id).returns(() => NewJobAction.ID);
mockNewStepAction.setup(s => s.label).returns(() => NewJobAction.LABEL);
assert.equal(mockNewStepAction.object.id, NewJobAction.ID);
assert.equal(mockNewStepAction.object.label, NewJobAction.LABEL);
assert.strictEqual(mockNewStepAction.object.id, NewJobAction.ID);
assert.strictEqual(mockNewStepAction.object.label, NewJobAction.LABEL);
// New Step Action should called command service
await mockNewStepAction.object.run(null);
@@ -188,8 +188,8 @@ suite('Job Management Actions', () => {
});
mockDeleteStepAction.setup(s => s.id).returns(() => DeleteStepAction.ID);
mockDeleteStepAction.setup(s => s.label).returns(() => DeleteStepAction.LABEL);
assert.equal(mockDeleteStepAction.object.id, DeleteStepAction.ID);
assert.equal(mockDeleteStepAction.object.label, DeleteStepAction.LABEL);
assert.strictEqual(mockDeleteStepAction.object.id, DeleteStepAction.ID);
assert.strictEqual(mockDeleteStepAction.object.label, DeleteStepAction.LABEL);
// Delete Step Action should called command service
await mockDeleteStepAction.object.run(null);
@@ -202,8 +202,8 @@ suite('Job Management Actions', () => {
mockNewAlertAction.setup(s => s.run(TypeMoq.It.isAny())).returns(() => mockAlertsViewComponent.object.openCreateAlertDialog());
mockNewAlertAction.setup(s => s.id).returns(() => NewJobAction.ID);
mockNewAlertAction.setup(s => s.label).returns(() => NewJobAction.LABEL);
assert.equal(mockNewAlertAction.object.id, NewJobAction.ID);
assert.equal(mockNewAlertAction.object.label, NewJobAction.LABEL);
assert.strictEqual(mockNewAlertAction.object.id, NewJobAction.ID);
assert.strictEqual(mockNewAlertAction.object.label, NewJobAction.LABEL);
// New Alert Action from Alerts View should open a dialog
await mockNewAlertAction.object.run(null);
@@ -215,8 +215,8 @@ suite('Job Management Actions', () => {
mockEditAlertAction.setup(s => s.run(TypeMoq.It.isAny()));
mockEditAlertAction.setup(s => s.id).returns(() => EditAlertAction.ID);
mockEditAlertAction.setup(s => s.label).returns(() => EditAlertAction.LABEL);
assert.equal(mockEditAlertAction.object.id, EditAlertAction.ID);
assert.equal(mockEditAlertAction.object.label, EditAlertAction.LABEL);
assert.strictEqual(mockEditAlertAction.object.id, EditAlertAction.ID);
assert.strictEqual(mockEditAlertAction.object.label, EditAlertAction.LABEL);
// Edit Alert Action from Jobs View should open a dialog
await mockEditAlertAction.object.run(null);
@@ -230,8 +230,8 @@ suite('Job Management Actions', () => {
});
mockDeleteAlertAction.setup(s => s.id).returns(() => DeleteAlertAction.ID);
mockDeleteAlertAction.setup(s => s.label).returns(() => DeleteAlertAction.LABEL);
assert.equal(mockDeleteAlertAction.object.id, DeleteAlertAction.ID);
assert.equal(mockDeleteAlertAction.object.label, DeleteAlertAction.LABEL);
assert.strictEqual(mockDeleteAlertAction.object.id, DeleteAlertAction.ID);
assert.strictEqual(mockDeleteAlertAction.object.label, DeleteAlertAction.LABEL);
// Delete Alert Action should call job management service
await mockDeleteAlertAction.object.run(null);
@@ -244,8 +244,8 @@ suite('Job Management Actions', () => {
mockNewOperatorAction.setup(s => s.run(TypeMoq.It.isAny())).returns(() => mockOperatorsViewComponent.object.openCreateOperatorDialog());
mockNewOperatorAction.setup(s => s.id).returns(() => NewOperatorAction.ID);
mockNewOperatorAction.setup(s => s.label).returns(() => NewOperatorAction.LABEL);
assert.equal(mockNewOperatorAction.object.id, NewOperatorAction.ID);
assert.equal(mockNewOperatorAction.object.label, NewOperatorAction.LABEL);
assert.strictEqual(mockNewOperatorAction.object.id, NewOperatorAction.ID);
assert.strictEqual(mockNewOperatorAction.object.label, NewOperatorAction.LABEL);
// New Operator Action from Operators View should open a dialog
await mockNewOperatorAction.object.run(null);
@@ -257,8 +257,8 @@ suite('Job Management Actions', () => {
mockEditOperatorAction.setup(s => s.run(TypeMoq.It.isAny()));
mockEditOperatorAction.setup(s => s.id).returns(() => EditOperatorAction.ID);
mockEditOperatorAction.setup(s => s.label).returns(() => EditOperatorAction.LABEL);
assert.equal(mockEditOperatorAction.object.id, EditOperatorAction.ID);
assert.equal(mockEditOperatorAction.object.label, EditOperatorAction.LABEL);
assert.strictEqual(mockEditOperatorAction.object.id, EditOperatorAction.ID);
assert.strictEqual(mockEditOperatorAction.object.label, EditOperatorAction.LABEL);
// Edit Operator Action from Jobs View should open a dialog
await mockEditOperatorAction.object.run(null);
@@ -272,8 +272,8 @@ suite('Job Management Actions', () => {
});
mockDeleteOperatorAction.setup(s => s.id).returns(() => DeleteOperatorAction.ID);
mockDeleteOperatorAction.setup(s => s.label).returns(() => DeleteOperatorAction.LABEL);
assert.equal(mockDeleteOperatorAction.object.id, DeleteOperatorAction.ID);
assert.equal(mockDeleteOperatorAction.object.label, DeleteOperatorAction.LABEL);
assert.strictEqual(mockDeleteOperatorAction.object.id, DeleteOperatorAction.ID);
assert.strictEqual(mockDeleteOperatorAction.object.label, DeleteOperatorAction.LABEL);
// Delete Operator Action should call job management service
await mockDeleteOperatorAction.object.run(null);
@@ -286,8 +286,8 @@ suite('Job Management Actions', () => {
mockNewProxyAction.setup(s => s.run(TypeMoq.It.isAny())).returns(() => mockProxiesViewComponent.object.openCreateProxyDialog());
mockNewProxyAction.setup(s => s.id).returns(() => NewProxyAction.ID);
mockNewProxyAction.setup(s => s.label).returns(() => NewProxyAction.LABEL);
assert.equal(mockNewProxyAction.object.id, NewProxyAction.ID);
assert.equal(mockNewProxyAction.object.label, NewProxyAction.LABEL);
assert.strictEqual(mockNewProxyAction.object.id, NewProxyAction.ID);
assert.strictEqual(mockNewProxyAction.object.label, NewProxyAction.LABEL);
// New Proxy Action from Alerts View should open a dialog
await mockNewProxyAction.object.run(null);
@@ -299,8 +299,8 @@ suite('Job Management Actions', () => {
mockEditProxyAction.setup(s => s.run(TypeMoq.It.isAny()));
mockEditProxyAction.setup(s => s.id).returns(() => EditProxyAction.ID);
mockEditProxyAction.setup(s => s.label).returns(() => EditProxyAction.LABEL);
assert.equal(mockEditProxyAction.object.id, EditProxyAction.ID);
assert.equal(mockEditProxyAction.object.label, EditProxyAction.LABEL);
assert.strictEqual(mockEditProxyAction.object.id, EditProxyAction.ID);
assert.strictEqual(mockEditProxyAction.object.label, EditProxyAction.LABEL);
// Edit Proxy Action from Proxies View should open a dialog
await mockEditProxyAction.object.run(null);
@@ -314,8 +314,8 @@ suite('Job Management Actions', () => {
});
mockDeleteProxyAction.setup(s => s.id).returns(() => DeleteProxyAction.ID);
mockDeleteProxyAction.setup(s => s.label).returns(() => DeleteProxyAction.LABEL);
assert.equal(mockDeleteProxyAction.object.id, DeleteProxyAction.ID);
assert.equal(mockDeleteProxyAction.object.label, DeleteProxyAction.LABEL);
assert.strictEqual(mockDeleteProxyAction.object.id, DeleteProxyAction.ID);
assert.strictEqual(mockDeleteProxyAction.object.label, DeleteProxyAction.LABEL);
// Delete Proxy Action should call job management service
await mockDeleteProxyAction.object.run(null);

View File

@@ -32,66 +32,66 @@ suite('Cell Magic Mapper', function (): void {
test('Should find no magics when empty array passed into constructor', () => {
cellMagicMapper = new CellMagicMapper([]);
magic = cellMagicMapper.toLanguageMagic('', '');
assert.equal(magic, undefined, 'cell magic should not exist when magic name and kernel is empty string');
assert.strictEqual(magic, undefined, 'cell magic should not exist when magic name and kernel is empty string');
magic = cellMagicMapper.toLanguageMagic('magicName', 'kernel1');
assert.equal(magic, undefined, 'cell magic should not exist when magic name and kernel strings are not empty');
assert.strictEqual(magic, undefined, 'cell magic should not exist when magic name and kernel strings are not empty');
magic = cellMagicMapper.toLanguageMagic(undefined, undefined);
assert.equal(magic, undefined, 'cell magic should not exist when magic name and kernel strings are undefined');
assert.strictEqual(magic, undefined, 'cell magic should not exist when magic name and kernel strings are undefined');
});
test('Should find magic when magic is passed into constructor', () => {
cellMagicMapper = new CellMagicMapper([sampleLanguageMagicWithKernel]);
magic = cellMagicMapper.toLanguageMagic('sampleMagic', 'kernel1');
assert.deepEqual(magic, sampleLanguageMagicWithKernel, 'cell magic should match sample magic when looking for first kernel');
assert.deepStrictEqual(magic, sampleLanguageMagicWithKernel, 'cell magic should match sample magic when looking for first kernel');
magic = cellMagicMapper.toLanguageMagic('sampleMagic', 'kernel2');
assert.deepEqual(magic, sampleLanguageMagicWithKernel, 'cell magic should match sample magic when looking for second kernel');
assert.deepStrictEqual(magic, sampleLanguageMagicWithKernel, 'cell magic should match sample magic when looking for second kernel');
});
test('Should not find magic when kernel does not match', () => {
cellMagicMapper = new CellMagicMapper([sampleLanguageMagicWithKernel]);
magic = cellMagicMapper.toLanguageMagic('sampleMagic', 'kernel3');
assert.equal(magic, undefined, 'cell magic be undefined when kernel name does not match');
assert.strictEqual(magic, undefined, 'cell magic be undefined when kernel name does not match');
magic = cellMagicMapper.toLanguageMagic('sampleMagic', '');
assert.equal(magic, undefined, 'cell magic be undefined when kernel name is empty string');
assert.strictEqual(magic, undefined, 'cell magic be undefined when kernel name is empty string');
magic = cellMagicMapper.toLanguageMagic('sampleMagic', undefined);
assert.equal(magic, undefined, 'cell magic be undefined when kernel name is undefined');
assert.strictEqual(magic, undefined, 'cell magic be undefined when kernel name is undefined');
});
test('Should not find magic when magic name does not match', () => {
cellMagicMapper = new CellMagicMapper([sampleLanguageMagicWithKernel]);
magic = cellMagicMapper.toLanguageMagic('sampleMagic1', 'kernel1');
assert.equal(magic, undefined, 'cell magic be undefined when magic name does not match');
assert.strictEqual(magic, undefined, 'cell magic be undefined when magic name does not match');
magic = cellMagicMapper.toLanguageMagic('', 'kernel1');
assert.equal(magic, undefined, 'cell magic be undefined when magic name is empty string');
assert.strictEqual(magic, undefined, 'cell magic be undefined when magic name is empty string');
magic = cellMagicMapper.toLanguageMagic(undefined, 'kernel1');
assert.equal(magic, undefined, 'cell magic be undefined when magic name is undefined');
assert.strictEqual(magic, undefined, 'cell magic be undefined when magic name is undefined');
});
test('Should find magic when kernel is not passed in', () => {
cellMagicMapper = new CellMagicMapper([sampleLanguageMagicWithoutKernel]);
magic = cellMagicMapper.toLanguageMagic('sampleMagicAllKernels', 'kernel1');
assert.deepEqual(magic, sampleLanguageMagicWithoutKernel, 'magic should have been found when no kernel was passed in');
assert.deepStrictEqual(magic, sampleLanguageMagicWithoutKernel, 'magic should have been found when no kernel was passed in');
magic = cellMagicMapper.toLanguageMagic('sampleMagic1', 'kernel1');
assert.equal(magic, undefined, 'magic should not be found, since magic name does not match');
assert.strictEqual(magic, undefined, 'magic should not be found, since magic name does not match');
});
test('Should find magic multiple magics exist for same kernel', () => {
cellMagicMapper = new CellMagicMapper([sampleLanguageMagicWithoutKernel, sampleLanguageMagicWithKernel, otherLanguageMagicWithKernel]);
magic = cellMagicMapper.toLanguageMagic('sampleMagicAllKernels', 'kernel2');
assert.deepEqual(magic, sampleLanguageMagicWithoutKernel, 'magic should have been found when no kernel was passed in');
assert.deepStrictEqual(magic, sampleLanguageMagicWithoutKernel, 'magic should have been found when no kernel was passed in');
magic = cellMagicMapper.toLanguageMagic('sampleMagic', 'kernel2');
assert.deepEqual(magic, sampleLanguageMagicWithKernel, 'magic should have been found when kernel was passed in');
assert.deepStrictEqual(magic, sampleLanguageMagicWithKernel, 'magic should have been found when kernel was passed in');
magic = cellMagicMapper.toLanguageMagic('otherMagic', 'kernel2');
assert.deepEqual(magic, otherLanguageMagicWithKernel, 'magic should have been found for second magic with kernel passed in');
assert.deepStrictEqual(magic, otherLanguageMagicWithKernel, 'magic should have been found for second magic with kernel passed in');
});
});

View File

@@ -129,7 +129,7 @@ suite('CellToolbarActions', function (): void {
cellModelMock.setup(x => x.cellType).returns(() => 'code');
const action = new CellToggleMoreActions(instantiationService);
action.onInit(testContainer, contextMock.object);
assert.equal(action['_moreActions']['viewItems'][0]['_action']['_actions'].length, 18, 'Unexpected number of valid elements');
assert.strictEqual(action['_moreActions']['viewItems'][0]['_action']['_actions'].length, 18, 'Unexpected number of valid elements');
});
test('CellToggleMoreActions with Markdown CellType', function (): void {
@@ -138,7 +138,7 @@ suite('CellToolbarActions', function (): void {
const action = new CellToggleMoreActions(instantiationService);
action.onInit(testContainer, contextMock.object);
// Markdown elements don't show the code-cell related actions such as Run Cell
assert.equal(action['_moreActions']['viewItems'][0]['_action']['_actions'].length, 7, 'Unexpected number of valid elements');
assert.strictEqual(action['_moreActions']['viewItems'][0]['_action']['_actions'].length, 7, 'Unexpected number of valid elements');
});
});
@@ -154,29 +154,29 @@ suite('CellToolbarActions', function (): void {
test('No notebook model passed in', async function (): Promise<void> {
let cellModel = new CellModel({ cell_type: 'code', source: '' }, { isTrusted: true, notebook: undefined });
await convertCellAction.doRun({ cell: cellModel, model: undefined });
assert.equal(cellModel.cellType, 'code', 'Cell type should not be affected');
assert.strictEqual(cellModel.cellType, 'code', 'Cell type should not be affected');
});
test('Convert to code cell', async function (): Promise<void> {
await notebookModel.loadContents();
await convertCellAction.doRun({ model: notebookModel, cell: notebookModel.cells[0] });
assert.equal(notebookModel.cells[0].cellType, 'markdown', 'Cell was not converted correctly');
assert.strictEqual(notebookModel.cells[0].cellType, 'markdown', 'Cell was not converted correctly');
});
test('Convert to markdown cell', async function (): Promise<void> {
await notebookModel.loadContents();
notebookModel.cells[0].cellType = 'markdown';
await convertCellAction.doRun({ model: notebookModel, cell: notebookModel.cells[0] });
assert.equal(notebookModel.cells[0].cellType, 'code', 'Cell was not converted correctly');
assert.strictEqual(notebookModel.cells[0].cellType, 'code', 'Cell was not converted correctly');
});
test('Convert to code cell and back', async function (): Promise<void> {
await notebookModel.loadContents();
notebookModel.cells[0].cellType = 'markdown';
await convertCellAction.doRun({ model: notebookModel, cell: notebookModel.cells[0] });
assert.equal(notebookModel.cells[0].cellType, 'code', 'Cell was not converted correctly');
assert.strictEqual(notebookModel.cells[0].cellType, 'code', 'Cell was not converted correctly');
await convertCellAction.doRun({ model: notebookModel, cell: notebookModel.cells[0] });
assert.equal(notebookModel.cells[0].cellType, 'markdown', 'Cell was not converted correctly second time');
assert.strictEqual(notebookModel.cells[0].cellType, 'markdown', 'Cell was not converted correctly second time');
});
});
});

View File

@@ -123,9 +123,9 @@ suite('Data Resource Data Provider', function () {
serializerStub.restore();
const noHeadersResult = await fs.readFile(noHeadersFile.fsPath);
assert.equal(noHeadersResult.toString(), '1 2 \n3 4 \n', 'result data should not include headers');
assert.strictEqual(noHeadersResult.toString(), '1 2 \n3 4 \n', 'result data should not include headers');
const withHeadersResult = await fs.readFile(withHeadersFile.fsPath);
assert.equal(withHeadersResult.toString(), 'col1 col2 \n1 2 \n3 4 \n', 'result data should include headers');
assert.strictEqual(withHeadersResult.toString(), 'col1 col2 \n1 2 \n3 4 \n', 'result data should include headers');
});
});

View File

@@ -152,14 +152,14 @@ suite('MarkdownTextTransformer', () => {
});
test('Ensure notebook editor returns expected object', async () => {
assert.deepEqual(notebookEditor, markdownTextTransformer.notebookEditor, 'Notebook editor does not match expected value');
assert.deepStrictEqual(notebookEditor, markdownTextTransformer.notebookEditor, 'Notebook editor does not match expected value');
// Set markdown text transformer to not have a notebook editor passed in
markdownTextTransformer = new MarkdownTextTransformer(mockNotebookService.object, cellModel);
assert.equal(markdownTextTransformer.notebookEditor, undefined, 'No notebook editor should be returned');
assert.strictEqual(markdownTextTransformer.notebookEditor, undefined, 'No notebook editor should be returned');
// Even after text is attempted to be transformed, there should be no editor, and therefore nothing on the text model
await markdownTextTransformer.transformText(MarkdownButtonType.BOLD);
assert.equal(markdownTextTransformer.notebookEditor, undefined, 'Notebook model does not have a valid uri, so no editor should be returned');
assert.equal(textModel.getValue(), '', 'No text should exist on the textModel');
assert.strictEqual(markdownTextTransformer.notebookEditor, undefined, 'Notebook model does not have a valid uri, so no editor should be returned');
assert.strictEqual(textModel.getValue(), '', 'No text should exist on the textModel');
});
async function testWithNoSelection(type: MarkdownButtonType, expectedValue: string, setValue = false): Promise<void> {
@@ -167,7 +167,7 @@ suite('MarkdownTextTransformer', () => {
textModel.setValue('');
}
await markdownTextTransformer.transformText(type);
assert.equal(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with no selection failed (setValue ${setValue})`);
assert.strictEqual(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with no selection failed (setValue ${setValue})`);
}
@@ -176,7 +176,7 @@ suite('MarkdownTextTransformer', () => {
textModel.setValue('');
}
await insertFormattedMarkdown('[test](./URL)', widget);
assert.equal(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with no selection and previously transformed md failed (setValue ${setValue})`);
assert.strictEqual(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with no selection and previously transformed md failed (setValue ${setValue})`);
}
async function testWithSingleWordSelected(type: MarkdownButtonType, expectedValue: string): Promise<void> {
@@ -185,17 +185,17 @@ suite('MarkdownTextTransformer', () => {
// Test transformation (adding text)
widget.setSelection({ startColumn: 1, startLineNumber: 1, endColumn: value.length + 1, endLineNumber: 1 });
assert.equal(textModel.getValueInRange(widget.getSelection()), value, 'Expected selection is not found');
assert.strictEqual(textModel.getValueInRange(widget.getSelection()), value, 'Expected selection is not found');
await markdownTextTransformer.transformText(type);
const textModelValue = textModel.getValue();
assert.equal(textModelValue, expectedValue, `${MarkdownButtonType[type]} with single word selection failed`);
assert.strictEqual(textModelValue, expectedValue, `${MarkdownButtonType[type]} with single word selection failed`);
// Test undo (removing text)
const valueRange = getValueRange(textModel, value);
assert.notEqual(valueRange, undefined, 'Could not find value in model after transformation');
assert.notStrictEqual(valueRange, undefined, 'Could not find value in model after transformation');
widget.setSelection(valueRange);
await markdownTextTransformer.transformText(type);
assert.equal(textModel.getValue(), value, `Undo operation for ${MarkdownButtonType[type]} with single word selection failed`);
assert.strictEqual(textModel.getValue(), value, `Undo operation for ${MarkdownButtonType[type]} with single word selection failed`);
}
async function testPreviouslyTransformedWithSingleWordSelected(type: MarkdownButtonType, expectedValue: string): Promise<void> {
@@ -204,44 +204,44 @@ suite('MarkdownTextTransformer', () => {
// Test transformation (adding text)
widget.setSelection({ startColumn: 1, startLineNumber: 1, endColumn: value.length + 1, endLineNumber: 1 });
assert.equal(textModel.getValueInRange(widget.getSelection()), value, 'Expected selection is not found');
assert.strictEqual(textModel.getValueInRange(widget.getSelection()), value, 'Expected selection is not found');
await insertFormattedMarkdown('[SampleURL](https://aka.ms)', widget);
const textModelValue = textModel.getValue();
assert.equal(textModelValue, expectedValue, `${MarkdownButtonType[type]} with single word selection and previously transformed md failed`);
assert.strictEqual(textModelValue, expectedValue, `${MarkdownButtonType[type]} with single word selection and previously transformed md failed`);
}
async function testWithMultipleWordsSelected(type: MarkdownButtonType, expectedValue: string): Promise<void> {
let value = 'Multi Words';
textModel.setValue(value);
widget.setSelection({ startColumn: 1, startLineNumber: 1, endColumn: 12, endLineNumber: 1 });
assert.equal(textModel.getValueInRange(widget.getSelection()), value, 'Expected multi-word selection is not found');
assert.strictEqual(textModel.getValueInRange(widget.getSelection()), value, 'Expected multi-word selection is not found');
await markdownTextTransformer.transformText(type);
assert.equal(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with multiple word selection failed`);
assert.strictEqual(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with multiple word selection failed`);
// Test undo (removing text)
const valueRange = getValueRange(textModel, value);
assert.notEqual(valueRange, undefined, 'Could not find value in model after transformation');
assert.notStrictEqual(valueRange, undefined, 'Could not find value in model after transformation');
widget.setSelection(valueRange);
await markdownTextTransformer.transformText(type);
assert.equal(textModel.getValue(), value, `Undo operation for ${MarkdownButtonType[type]} with multiple word selection failed`);
assert.strictEqual(textModel.getValue(), value, `Undo operation for ${MarkdownButtonType[type]} with multiple word selection failed`);
}
async function testWithMultipleLinesSelected(type: MarkdownButtonType, expectedValue: string): Promise<void> {
let value = 'Multi\nLines\nSelected';
textModel.setValue(value);
widget.setSelection({ startColumn: 1, startLineNumber: 1, endColumn: 9, endLineNumber: 3 });
assert.equal(textModel.getValueInRange(widget.getSelection()), value, 'Expected multi-line selection is not found');
assert.strictEqual(textModel.getValueInRange(widget.getSelection()), value, 'Expected multi-line selection is not found');
await markdownTextTransformer.transformText(type);
assert.equal(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with multiple line selection failed`);
assert.strictEqual(textModel.getValue(), expectedValue, `${MarkdownButtonType[type]} with multiple line selection failed`);
// Test undo (removing text)
let valueRange = getValueRange(textModel, 'Multi');
// Modify the range to include all the lines
valueRange = new Range(valueRange.startLineNumber, valueRange.startColumn, valueRange.endLineNumber + 2, 9);
assert.notEqual(valueRange, undefined, 'Could not find value in model after transformation');
assert.notStrictEqual(valueRange, undefined, 'Could not find value in model after transformation');
widget.setSelection(valueRange);
await markdownTextTransformer.transformText(type);
assert.equal(textModel.getValue(), value, `Undo operation for ${MarkdownButtonType[type]} with multiple line selection failed`);
assert.strictEqual(textModel.getValue(), value, `Undo operation for ${MarkdownButtonType[type]} with multiple line selection failed`);
}
});

View File

@@ -263,7 +263,7 @@ suite('Test class NotebookEditor:', () => {
changeDecorationsCalled = true;
return returnObject;
});
assert.notEqual(changeDecorationsCalled, true, `changeDecorations callback should not have been called`);
assert.notStrictEqual(changeDecorationsCalled, true, `changeDecorations callback should not have been called`);
assert.notStrictEqual(result, returnObject, 'object returned by the callback given to changeDecorations() call must not be returned by it');
assert.strictEqual(result, null, 'return value of changeDecorations() call must be null when no input is set on notebookEditor object');
});

View File

@@ -60,7 +60,7 @@ suite('Notebook Explorer Views', () => {
let retrieved = Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getView('notebookView-test-1');
assert(d === retrieved, 'Could not register view :' + d.id + 'Retrieved: ' + retrieved);
let newCount = Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews(NOTEBOOK_VIEW_CONTAINER).length;
assert.equal(oldcount + 1, newCount, 'View registration failed');
assert.strictEqual(oldcount + 1, newCount, 'View registration failed');
});
@@ -89,7 +89,7 @@ suite('Notebook Explorer Views', () => {
Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet(v1Duplicate);
let newCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
assert.equal(oldCount, newCount, 'Duplicate registration of views.');
assert.strictEqual(oldCount, newCount, 'Duplicate registration of views.');
});

View File

@@ -183,20 +183,20 @@ suite.skip('NotebookService:', function (): void {
});
test('Validate default properties on create', async function (): Promise<void> {
assert.equal(notebookService.languageMagics.length, 0, 'No language magics should exist after creation');
assert.equal(notebookService.listNotebookEditors().length, 0, 'No notebook editors should be listed');
assert.equal(notebookService.getMimeRegistry().mimeTypes.length, 15, 'MIME Types need to have appropriate tests when added or removed');
assert.deepEqual(notebookService.getProvidersForFileType('ipynb'), ['sql'], 'sql provider should be registered for ipynb extension');
assert.equal(notebookService.getStandardKernelsForProvider('sql').length, 1, 'SQL kernel should be provided by default');
assert.equal(notebookService.getStandardKernelsForProvider('otherProvider'), undefined, 'Other provider should not have kernels since it has not been added as a provider');
assert.deepEqual(notebookService.getSupportedFileExtensions(), ['IPYNB'], 'IPYNB file extension should be supported by default');
assert.strictEqual(notebookService.languageMagics.length, 0, 'No language magics should exist after creation');
assert.strictEqual(notebookService.listNotebookEditors().length, 0, 'No notebook editors should be listed');
assert.strictEqual(notebookService.getMimeRegistry().mimeTypes.length, 15, 'MIME Types need to have appropriate tests when added or removed');
assert.deepStrictEqual(notebookService.getProvidersForFileType('ipynb'), ['sql'], 'sql provider should be registered for ipynb extension');
assert.strictEqual(notebookService.getStandardKernelsForProvider('sql').length, 1, 'SQL kernel should be provided by default');
assert.strictEqual(notebookService.getStandardKernelsForProvider('otherProvider'), undefined, 'Other provider should not have kernels since it has not been added as a provider');
assert.deepStrictEqual(notebookService.getSupportedFileExtensions(), ['IPYNB'], 'IPYNB file extension should be supported by default');
await notebookService.registrationComplete;
assert.ok(notebookService.isRegistrationComplete, `notebookService.isRegistrationComplete should be true once its registrationComplete promise is resolved`);
});
test('Validate another provider added successfully', async function (): Promise<void> {
await notebookService.registrationComplete;
assert.deepEqual(notebookService.getProvidersForFileType('ipynb'), ['sql'], 'sql provider should be registered for ipynb extension');
assert.deepStrictEqual(notebookService.getProvidersForFileType('ipynb'), ['sql'], 'sql provider should be registered for ipynb extension');
const otherProviderRegistration: NotebookProviderRegistration = {
fileExtensions: 'ipynb',
@@ -211,10 +211,10 @@ suite.skip('NotebookService:', function (): void {
const notebookRegistry = Registry.as<INotebookProviderRegistry>(Extensions.NotebookProviderContribution);
notebookRegistry.registerNotebookProvider(otherProviderRegistration);
assert.deepEqual(notebookService.getProvidersForFileType('ipynb'), ['sql', 'otherProvider'], 'otherProvider should also be registered for ipynb extension');
assert.deepEqual(notebookService.getSupportedFileExtensions(), ['IPYNB'], 'Only IPYNB should be registered as supported file extension');
assert.equal(notebookService.getStandardKernelsForProvider('otherProvider').length, 1, 'otherProvider kernel info could not be found');
assert.deepEqual(notebookService.getStandardKernelsForProvider('otherProvider')[0], otherProviderRegistration.standardKernels, 'otherProviderRegistration standard kernels does not match');
assert.deepStrictEqual(notebookService.getProvidersForFileType('ipynb'), ['sql', 'otherProvider'], 'otherProvider should also be registered for ipynb extension');
assert.deepStrictEqual(notebookService.getSupportedFileExtensions(), ['IPYNB'], 'Only IPYNB should be registered as supported file extension');
assert.strictEqual(notebookService.getStandardKernelsForProvider('otherProvider').length, 1, 'otherProvider kernel info could not be found');
assert.deepStrictEqual(notebookService.getStandardKernelsForProvider('otherProvider')[0], otherProviderRegistration.standardKernels, 'otherProviderRegistration standard kernels does not match');
});
test('tests that dispose() method calls dispose on underlying disposable objects exactly once', async () => {
@@ -570,7 +570,7 @@ suite.skip('NotebookService:', function (): void {
let getUntitledUriPathSpy = sinon.spy(notebookService, 'getUntitledUriPath');
notebookService.getUntitledUriPath('title.ipynb');
sinon.assert.calledOnce(getUntitledUriPathSpy);
assert.equal(getUntitledUriPathSpy, 'title-0.ipynb');
assert.strictEqual(getUntitledUriPathSpy, 'title-0.ipynb');
});
});

View File

@@ -96,9 +96,9 @@ suite('NotebookViewModel', function (): void {
let cellsWithNewView = notebookViews.getCells().filter(cell => cell.views.find(v => v.guid === viewModel.guid));
assert.equal(cellsWithNewView.length, 2);
assert.equal(viewModel.cells.length, 2);
assert.equal(viewModel.name, defaultViewName);
assert.strictEqual(cellsWithNewView.length, 2);
assert.strictEqual(viewModel.cells.length, 2);
assert.strictEqual(viewModel.name, defaultViewName);
});
test('initialize notebook with no metadata', async function (): Promise<void> {
@@ -108,9 +108,9 @@ suite('NotebookViewModel', function (): void {
let cellsWithNewView = notebookViews.getCells().filter(cell => cell.views.find(v => v.guid === viewModel.guid));
assert.equal(cellsWithNewView.length, 2);
assert.equal(viewModel.cells.length, 2);
assert.equal(viewModel.name, defaultViewName);
assert.strictEqual(cellsWithNewView.length, 2);
assert.strictEqual(viewModel.cells.length, 2);
assert.strictEqual(viewModel.name, defaultViewName);
});
test('rename', async function (): Promise<void> {
@@ -125,7 +125,7 @@ suite('NotebookViewModel', function (): void {
exceptionThrown = true;
}
assert.equal(view.name, `${defaultViewName} 1`);
assert.strictEqual(view.name, `${defaultViewName} 1`);
assert(!exceptionThrown);
});
@@ -155,7 +155,7 @@ suite('NotebookViewModel', function (): void {
viewModel.hideCell(cellToHide);
assert.equal(viewModel.hiddenCells.length, 1);
assert.strictEqual(viewModel.hiddenCells.length, 1);
assert(viewModel.hiddenCells.includes(cellToHide));
});
@@ -183,8 +183,8 @@ suite('NotebookViewModel', function (): void {
viewModel.moveCell(cellToMove, 98, 99);
let cellMeta = viewModel.getCellMetadata(cellToMove);
assert.equal(cellMeta.x, 98);
assert.equal(cellMeta.y, 99);
assert.strictEqual(cellMeta.x, 98);
assert.strictEqual(cellMeta.y, 99);
});
test('resize cell', async function (): Promise<void> {
@@ -197,8 +197,8 @@ suite('NotebookViewModel', function (): void {
viewModel.resizeCell(cellToResize, 3, 4);
let cellMeta = viewModel.getCellMetadata(cellToResize);
assert.equal(cellMeta.width, 3);
assert.equal(cellMeta.height, 4);
assert.strictEqual(cellMeta.width, 3);
assert.strictEqual(cellMeta.height, 4);
});
test('get cell metadata', async function (): Promise<void> {
@@ -210,7 +210,7 @@ suite('NotebookViewModel', function (): void {
let cellMeta = notebookViews.getCellMetadata(cell);
assert(!isUndefinedOrNull(cellMeta.views.find(v => v.guid === viewModel.guid)));
assert.deepEqual(viewModel.getCellMetadata(cell), cellMeta.views.find(v => v.guid === viewModel.guid));
assert.deepStrictEqual(viewModel.getCellMetadata(cell), cellMeta.views.find(v => v.guid === viewModel.guid));
});
test('delete', async function (): Promise<void> {

View File

@@ -76,14 +76,14 @@ suite('NotebookViews', function (): void {
});
test('create new view', async function (): Promise<void> {
assert.equal(notebookViews.getViews().length, 0, 'notebook should not initially generate any views');
assert.strictEqual(notebookViews.getViews().length, 0, 'notebook should not initially generate any views');
let newView = notebookViews.createNewView(defaultViewName);
let cellsWithMatchingGuid = newView.cells.filter(cell => newView.getCellMetadata(cell).guid === newView.guid);
assert.equal(newView.name, defaultViewName, 'view was not created with its given name');
assert.equal(newView.cells.length, 2, 'view did not contain the same number of cells as the notebook used to create it');
assert.equal(cellsWithMatchingGuid.length, newView.cells.length, 'cell metadata was not created for all cells in view');
assert.strictEqual(newView.name, defaultViewName, 'view was not created with its given name');
assert.strictEqual(newView.cells.length, 2, 'view did not contain the same number of cells as the notebook used to create it');
assert.strictEqual(cellsWithMatchingGuid.length, newView.cells.length, 'cell metadata was not created for all cells in view');
});
test('remove view', async function (): Promise<void> {
@@ -93,23 +93,23 @@ suite('NotebookViews', function (): void {
let cellsWithNewView = notebookViews.getCells().filter(cell => cell.views.find(v => v.guid === newView.guid));
assert.equal(notebookViews.getViews().length, 0, 'view not removed from notebook metadata');
assert.equal(cellsWithNewView.length, 0, 'view not removed from cells');
assert.strictEqual(notebookViews.getViews().length, 0, 'view not removed from notebook metadata');
assert.strictEqual(cellsWithNewView.length, 0, 'view not removed from cells');
});
test('default view name', async function (): Promise<void> {
let newView = notebookViews.createNewView();
assert.equal(newView.name, NotebookViewsExtension.defaultViewName);
assert.strictEqual(newView.name, NotebookViewsExtension.defaultViewName);
let newView1 = notebookViews.createNewView();
assert.equal(newView1.name, `${NotebookViewsExtension.defaultViewName} 1`);
assert.strictEqual(newView1.name, `${NotebookViewsExtension.defaultViewName} 1`);
});
test('active view', async function (): Promise<void> {
let newView = notebookViews.createNewView();
notebookViews.setActiveView(newView);
assert.equal(notebookViews.getActiveView(), newView);
assert.strictEqual(notebookViews.getActiveView(), newView);
});
test('update cell', async function (): Promise<void> {

View File

@@ -6,26 +6,25 @@
import * as assert from 'assert';
import { nb } from 'azdata';
import * as op from 'sql/workbench/contrib/notebook/browser/models/outputProcessor';
import { JSONObject } from 'sql/workbench/services/notebook/common/jsonext';
import { nbformat as nbformat } from 'sql/workbench/services/notebook/common/nbformat';
suite('OutputProcessor functions', function (): void {
const text = 'An arbitrary text input:!@#$%^&*()_+~`:;,.-_=';
const arbitraryMetadata = {
// arbitrarily construction chart options. It is any JSONObject
azdata_chartOptions: {
scale: true,
dataGrid: false,
arbitraryCharProperty: {
prop1: 'value1',
prop2: {
deepProp1: 3
}
const arbitraryMetadata = Object.create(null); // Use null prototype in order to pass strict deepEqual assertions
arbitraryMetadata['azdata_chartOptions'] = {
'scale': true,
'dataGrid': false,
'arbitraryCharProperty': {
'prop1': 'value1',
'prop2': {
'deepProp1': 3
}
}
};
const emptyMetadata = Object.create(null);
suite('getData', function (): void {
// data tests
for (const outputType of ['execute_result', 'display_data', 'update_display_data'] as nbformat.OutputType[]) {
@@ -79,9 +78,9 @@ suite('OutputProcessor functions', function (): void {
output.metadata = arbitraryMetadata;
const result = op.getMetadata(output);
if (nbformat.isExecuteResult(output) || nbformat.isDisplayData(output)) {
assert.deepEqual(result, output.metadata, `getMetadata should return the metadata object passed in the output object`);
assert.deepStrictEqual(result, output.metadata, `getMetadata should return the metadata object passed in the output object`);
} else {
assert.deepEqual(result, {}, `getMetadata should return an empty object when output_type is not IDisplayData or IExecuteResult`);
assert.deepStrictEqual(result, emptyMetadata, `getMetadata should return an empty object when output_type is not IDisplayData or IExecuteResult`);
}
});
}
@@ -105,7 +104,7 @@ suite('OutputProcessor functions', function (): void {
metadata: op.getMetadata(output),
trusted: trusted
};
assert.deepEqual(result, expected, `getBundleOptions should return an object that has data and metadata fields as returned by getData and getMetadata calls and a trusted field as the value of the 'trusted' field in options passed to it`);
assert.deepStrictEqual(result, expected, `getBundleOptions should return an object that has data and metadata fields as returned by getData and getMetadata calls and a trusted field as the value of the 'trusted' field in options passed to it`);
});
}
}
@@ -114,22 +113,24 @@ suite('OutputProcessor functions', function (): void {
function verifyGetDataForDataOutput(output: nbformat.IExecuteResult | nbformat.IDisplayData | nbformat.IDisplayUpdate) {
const result = op.getData(output);
const expectedData = Object.create(null);
for (let key in output.data) {
expectedData[key] = output.data[key];
}
// getData just returns the data property object for ExecutionResults/DisplayData/DisplayUpdate Output object sent to it.
assert.deepEqual(result, output.data, `getData should return the expectedData:${output.data} object`);
assert.deepStrictEqual(result, expectedData, `getData should return the expectedData: '${JSON.stringify(expectedData)}' object`);
}
function verifyGetDataForStreamOutput(output: nbformat.IStream): void {
// expected return value is an object with a single property of 'application/vnd.jupyter.stderr' or 'application/vnd.jupyter.stdout'
// corresponding to the stream name. The value of this property is the value of the 'text' field of the output object that was sent into the getData call
const expectedData = output.name === 'stderr'
? {
'application/vnd.jupyter.stderr': output.text,
}
: {
'application/vnd.jupyter.stdout': output.text,
};
let expectedStdErr = Object.create(null);
expectedStdErr['application/vnd.jupyter.stderr'] = output.text;
let expectedStdOut = Object.create(null);
expectedStdOut['application/vnd.jupyter.stdout'] = output.text;
const expectedData = output.name === 'stderr' ? expectedStdErr : expectedStdOut;
const result = op.getData(output);
assert.deepEqual(result, expectedData, `getData should return the expectedData:${expectedData} object`);
assert.deepStrictEqual(result, expectedData, `getData should return the expectedData: '${JSON.stringify(expectedData)}' object`);
}
function verifyGetDataForErrorOutput(output: nbformat.IError): void {
@@ -139,25 +140,19 @@ function verifyGetDataForErrorOutput(output: nbformat.IError): void {
// this property is assigned to a '\n' delimited traceback data when it is present.
// when traceback is absent this property gets ename and evalue information with ': ' as delimiter unless
// ename is empty in which case it is just evalue information.
let expectedData: JSONObject = {
'application/vnd.jupyter.stderr': undefined
};
let expectedData = Object.create(null);
expectedData['application/vnd.jupyter.stderr'] = undefined;
if (tracedata) {
expectedData = {
'application/vnd.jupyter.stderr': tracedata
};
expectedData['application/vnd.jupyter.stderr'] = tracedata;
}
else if (output.evalue) {
if (output.ename !== undefined && output.ename !== '') {
expectedData = {
'application/vnd.jupyter.stderr': `${output.ename}: ${output.evalue}`
};
expectedData['application/vnd.jupyter.stderr'] = `${output.ename}: ${output.evalue}`;
}
else {
expectedData = {
'application/vnd.jupyter.stderr': `${output.evalue}`
};
expectedData['application/vnd.jupyter.stderr'] = `${output.evalue}`;
}
}
assert.deepEqual(result, <JSONObject>expectedData, `getData should return the expectedData:'${JSON.stringify(expectedData)}' object`);
assert.deepStrictEqual(result, expectedData, `getData should return the expectedData: '${JSON.stringify(expectedData)}' object`);
}

View File

@@ -48,9 +48,9 @@ suite('Image Callout Dialog', function (): void {
imageCalloutDialog.cancel();
let result = await deferred.promise;
assert.equal(result.imagePath, undefined, 'ImagePath must be undefined');
assert.equal(result.embedImage, undefined, 'EmbedImage must be undefined');
assert.equal(result.insertEscapedMarkdown, '', 'Markdown not returned correctly');
assert.strictEqual(result.imagePath, undefined, 'ImagePath must be undefined');
assert.strictEqual(result.embedImage, undefined, 'EmbedImage must be undefined');
assert.strictEqual(result.insertEscapedMarkdown, '', 'Markdown not returned correctly');
});
test('Should return expected values on insert', async function (): Promise<void> {
@@ -69,9 +69,9 @@ suite('Image Callout Dialog', function (): void {
// And insert the dialog
imageCalloutDialog.insert();
let result = await deferred.promise;
assert.equal(result.imagePath, sampleImageFileUrl.fsPath, 'ImagePath not returned correctly');
assert.equal(result.embedImage, false, 'EmbedImage not returned correctly');
assert.equal(result.insertEscapedMarkdown, `![](${result.imagePath})`, 'Markdown not returned correctly');
assert.strictEqual(result.imagePath, sampleImageFileUrl.fsPath, 'ImagePath not returned correctly');
assert.strictEqual(result.embedImage, false, 'EmbedImage not returned correctly');
assert.strictEqual(result.insertEscapedMarkdown, `![](${result.imagePath})`, 'Markdown not returned correctly');
});
test('Should return expected values on insert when imageName has space', async function (): Promise<void> {
@@ -91,9 +91,9 @@ suite('Image Callout Dialog', function (): void {
// And insert the dialog
imageCalloutDialog.insert();
let result = await deferred.promise;
assert.equal(result.imagePath, sampleImageFileUrl.fsPath, 'imagePath not returned correctly');
assert.equal(result.embedImage, false, 'embedImage not returned correctly');
assert.equal(result.insertEscapedMarkdown, `![](${result.imagePath.replace(' ', '&#32;')})`, 'Markdown not returned correctly');
assert.strictEqual(result.imagePath, sampleImageFileUrl.fsPath, 'imagePath not returned correctly');
assert.strictEqual(result.embedImage, false, 'embedImage not returned correctly');
assert.strictEqual(result.insertEscapedMarkdown, `![](${result.imagePath.replace(' ', '&#32;')})`, 'Markdown not returned correctly');
});
test('Should return expected values on insert when add as attachment is set', async function (): Promise<void> {
@@ -115,9 +115,9 @@ suite('Image Callout Dialog', function (): void {
// And insert the dialog
imageCalloutDialog.insert();
let result = await deferred.promise;
assert.equal(result.imagePath, sampleImageFileUrl.fsPath, 'imagePath not returned correctly');
assert.equal(result.embedImage, true, 'embedImage not returned correctly');
assert.equal(result.insertEscapedMarkdown, `![${imageName}](attachment:${imageName})`, 'Markdown not returned correctly');
assert.strictEqual(result.imagePath, sampleImageFileUrl.fsPath, 'imagePath not returned correctly');
assert.strictEqual(result.embedImage, true, 'embedImage not returned correctly');
assert.strictEqual(result.insertEscapedMarkdown, `![${imageName}](attachment:${imageName})`, 'Markdown not returned correctly');
});
test('Should return expected values on insert when imageName has space and add attachment is set', async function (): Promise<void> {
@@ -139,9 +139,9 @@ suite('Image Callout Dialog', function (): void {
// And insert the dialog
imageCalloutDialog.insert();
let result = await deferred.promise;
assert.equal(result.imagePath, sampleImageFileUrl.fsPath, 'imagePath not returned correctly');
assert.equal(result.embedImage, true, 'embedImage not returned correctly');
assert.equal(result.insertEscapedMarkdown, `![${imageName}](attachment:${imageName.replace(' ', '')})`, 'Markdown not returned correctly');
assert.strictEqual(result.imagePath, sampleImageFileUrl.fsPath, 'imagePath not returned correctly');
assert.strictEqual(result.embedImage, true, 'embedImage not returned correctly');
assert.strictEqual(result.insertEscapedMarkdown, `![${imageName}](attachment:${imageName.replace(' ', '')})`, 'Markdown not returned correctly');
});
});

View File

@@ -9,34 +9,34 @@ import { isPrimitive } from 'sql/workbench/services/notebook/common/jsonext';
suite('jsonext', function (): void {
test('Validate null object is primitive', async function (): Promise<void> {
let object = null;
assert.equal(isPrimitive(object), true, 'null object should be primitive');
assert.strictEqual(isPrimitive(object), true, 'null object should be primitive');
object = undefined;
assert.equal(isPrimitive(object), false, 'undefined object should not be primitive');
assert.strictEqual(isPrimitive(object), false, 'undefined object should not be primitive');
});
test('Validate boolean types are primitive', async function (): Promise<void> {
let object: boolean = false;
assert.equal(isPrimitive(object), true, 'false boolean object should be primitive');
assert.strictEqual(isPrimitive(object), true, 'false boolean object should be primitive');
object = true;
assert.equal(isPrimitive(object), true, 'true boolean object should be primitive');
assert.strictEqual(isPrimitive(object), true, 'true boolean object should be primitive');
});
test('Validate number types are primitive', async function (): Promise<void> {
let object: number = 0;
assert.equal(isPrimitive(object), true, 'number with value 0 should be primitive');
assert.strictEqual(isPrimitive(object), true, 'number with value 0 should be primitive');
object = 1;
assert.equal(isPrimitive(object), true, 'number with value 1 should be primitive');
assert.strictEqual(isPrimitive(object), true, 'number with value 1 should be primitive');
});
test('Validate string types are primitive', async function (): Promise<void> {
let object: string = '';
assert.equal(isPrimitive(object), true, 'empty strings should be primitive');
assert.strictEqual(isPrimitive(object), true, 'empty strings should be primitive');
object = 'nonempty string';
assert.equal(isPrimitive(object), true, 'non-empty strings should be primitive');
assert.strictEqual(isPrimitive(object), true, 'non-empty strings should be primitive');
});
test('custom object is not primitive', async function (): Promise<void> {
let object = {
prop1: 'val1'
};
assert.equal(isPrimitive(object), false, 'custom object should not be primitive');
assert.strictEqual(isPrimitive(object), false, 'custom object should not be primitive');
object = undefined;
assert.equal(isPrimitive(object), false, 'undefined object should not be primitive');
assert.strictEqual(isPrimitive(object), false, 'undefined object should not be primitive');
});
});

View File

@@ -17,42 +17,42 @@ suite('nbformat', function (): void {
};
test('Validate display_data Output Type', async function (): Promise<void> {
sampleOutput.output_type = 'display_data';
assert.equal(nbformat.isDisplayData(sampleOutput), true, 'display_data output type not recognized correctly');
assert.equal(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.equal(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.equal(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.equal(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayData(sampleOutput), true, 'display_data output type not recognized correctly');
assert.strictEqual(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.strictEqual(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.strictEqual(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
});
test('Validate update_display_data Output Type', async function (): Promise<void> {
sampleOutput.output_type = 'update_display_data';
assert.equal(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.equal(nbformat.isDisplayUpdate(sampleOutput), true, 'update_display_data output type not recognized correctly');
assert.equal(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.equal(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.equal(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayUpdate(sampleOutput), true, 'update_display_data output type not recognized correctly');
assert.strictEqual(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.strictEqual(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.strictEqual(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
});
test('Validate error Output Type', async function (): Promise<void> {
sampleOutput.output_type = 'error';
assert.equal(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.equal(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.equal(nbformat.isError(sampleOutput), true, 'error output type not recognized correctly');
assert.equal(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.equal(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isError(sampleOutput), true, 'error output type not recognized correctly');
assert.strictEqual(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.strictEqual(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
});
test('Validate execute_result Output Type', async function (): Promise<void> {
sampleOutput.output_type = 'execute_result';
assert.equal(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.equal(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.equal(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.equal(nbformat.isExecuteResult(sampleOutput), true, 'execute_result output type not recognized correctly');
assert.equal(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.strictEqual(nbformat.isExecuteResult(sampleOutput), true, 'execute_result output type not recognized correctly');
assert.strictEqual(nbformat.isStream(sampleOutput), false, 'stream output type incorrectly recognized');
});
test('Validate stream Output Type', async function (): Promise<void> {
sampleOutput.output_type = 'stream';
assert.equal(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.equal(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.equal(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.equal(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.equal(nbformat.isStream(sampleOutput), true, 'stream output type not recognized correctly');
assert.strictEqual(nbformat.isDisplayData(sampleOutput), false, 'display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isDisplayUpdate(sampleOutput), false, 'update_display_data output type incorrectly recognized');
assert.strictEqual(nbformat.isError(sampleOutput), false, 'error output type incorrectly recognized');
assert.strictEqual(nbformat.isExecuteResult(sampleOutput), false, 'execute_result output type incorrectly recognized');
assert.strictEqual(nbformat.isStream(sampleOutput), true, 'stream output type not recognized correctly');
});
});

View File

@@ -36,16 +36,16 @@ suite('Cell Model', function (): void {
let factory = new ModelFactory(instantiationService);
test('Should set default values if none defined', async function (): Promise<void> {
let cell = factory.createCell(undefined, undefined);
assert.equal(cell.cellType, CellTypes.Code);
assert.equal(cell.source, '');
assert.strictEqual(cell.cellType, CellTypes.Code);
assert.strictEqual(cell.source, '');
});
test('Should update values', async function (): Promise<void> {
let cell = factory.createCell(undefined, undefined);
cell.setOverrideLanguage('sql');
assert.equal(cell.language, 'sql');
assert.strictEqual(cell.language, 'sql');
cell.source = 'abcd';
assert.equal(JSON.stringify(cell.source), JSON.stringify(['abcd']));
assert.strictEqual(JSON.stringify(cell.source), JSON.stringify(['abcd']));
});
test('Should match ICell values if defined', async function (): Promise<void> {
@@ -62,11 +62,11 @@ suite('Cell Model', function (): void {
execution_count: 1
};
let cell = factory.createCell(cellData, undefined);
assert.equal(cell.cellType, cellData.cell_type);
assert.equal(JSON.stringify(cell.source), JSON.stringify([cellData.source]));
assert.equal(cell.outputs.length, 1);
assert.equal(cell.outputs[0].output_type, 'stream');
assert.equal((<nb.IStreamResult>cell.outputs[0]).text, 'Some output');
assert.strictEqual(cell.cellType, cellData.cell_type);
assert.strictEqual(JSON.stringify(cell.source), JSON.stringify([cellData.source]));
assert.strictEqual(cell.outputs.length, 1);
assert.strictEqual(cell.outputs[0].output_type, 'stream');
assert.strictEqual((<nb.IStreamResult>cell.outputs[0]).text, 'Some output');
});
@@ -84,7 +84,7 @@ suite('Cell Model', function (): void {
mimetype: ''
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert.equal(cell.language, 'python');
assert.strictEqual(cell.language, 'python');
});
test('Should set cell language to python if defined as pyspark in languageInfo', async function (): Promise<void> {
@@ -101,7 +101,7 @@ suite('Cell Model', function (): void {
mimetype: ''
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert.equal(cell.language, 'python');
assert.strictEqual(cell.language, 'python');
});
test('Should keep cell language as python if cell has language override', async function (): Promise<void> {
@@ -118,7 +118,7 @@ suite('Cell Model', function (): void {
mimetype: ''
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert.equal(cell.language, 'python');
assert.strictEqual(cell.language, 'python');
});
test('Should set cell language to python if no language defined', async function (): Promise<void> {
@@ -135,7 +135,7 @@ suite('Cell Model', function (): void {
mimetype: ''
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert.equal(cell.language, 'python');
assert.strictEqual(cell.language, 'python');
});
test('Should allow source of type string[] with length 1', async function (): Promise<void> {
@@ -153,8 +153,8 @@ suite('Cell Model', function (): void {
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert(Array.isArray(cell.source));
assert.equal(cell.source.length, 1);
assert.equal(cell.source[0], 'print(1)');
assert.strictEqual(cell.source.length, 1);
assert.strictEqual(cell.source[0], 'print(1)');
});
test('Should allow source of type string', async function (): Promise<void> {
@@ -172,7 +172,7 @@ suite('Cell Model', function (): void {
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert(Array.isArray(cell.source));
assert.equal(JSON.stringify(cell.source), JSON.stringify(['print(1)']));
assert.strictEqual(JSON.stringify(cell.source), JSON.stringify(['print(1)']));
});
test('Should allow source of type string with newline and split it', async function (): Promise<void> {
@@ -190,9 +190,9 @@ suite('Cell Model', function (): void {
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert(Array.isArray(cell.source));
assert.equal(cell.source.length, 2);
assert.equal(cell.source[0], 'print(1)\n');
assert.equal(cell.source[1], 'print(2)');
assert.strictEqual(cell.source.length, 2);
assert.strictEqual(cell.source[0], 'print(1)\n');
assert.strictEqual(cell.source[1], 'print(2)');
});
test('Should allow source of type string with Windows style newline and split it', async function (): Promise<void> {
@@ -210,9 +210,9 @@ suite('Cell Model', function (): void {
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert(Array.isArray(cell.source));
assert.equal(cell.source.length, 2);
assert.equal(cell.source[0], 'print(1)\r\n');
assert.equal(cell.source[1], 'print(2)');
assert.strictEqual(cell.source.length, 2);
assert.strictEqual(cell.source[0], 'print(1)\r\n');
assert.strictEqual(cell.source[1], 'print(2)');
});
test('Should allow source of type string[] with length 2', async function (): Promise<void> {
@@ -230,9 +230,9 @@ suite('Cell Model', function (): void {
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert(Array.isArray(cell.source));
assert.equal(cell.source.length, 2);
assert.equal(cell.source[0], 'print(1)\n');
assert.equal(cell.source[1], 'print(2)');
assert.strictEqual(cell.source.length, 2);
assert.strictEqual(cell.source[0], 'print(1)\n');
assert.strictEqual(cell.source[1], 'print(2)');
});
test('Should allow empty string source', async function (): Promise<void> {
@@ -250,7 +250,7 @@ suite('Cell Model', function (): void {
});
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
assert(Array.isArray(cell.source));
assert.equal(JSON.stringify(cell.source), JSON.stringify(['']));
assert.strictEqual(JSON.stringify(cell.source), JSON.stringify(['']));
});
test('Should parse metadata\'s hide_input tag correctly', async function (): Promise<void> {
@@ -571,7 +571,7 @@ suite('Cell Model', function (): void {
cell.setFuture(future.object);
// Then I expect outputs to have been cleared
assert.equal(outputs.length, 0);
assert.strictEqual(outputs.length, 0);
assert(!isUndefinedOrNull(onReply));
// ... And when I send an IoPub message
let message: nb.IIOPubMessage = {
@@ -588,13 +588,13 @@ suite('Cell Model', function (): void {
};
onIopub.handle(message);
// Then I expect an output to be added
assert.equal(outputs.length, 1);
assert.equal(outputs[0].output_type, 'stream');
assert.strictEqual(outputs.length, 1);
assert.strictEqual(outputs[0].output_type, 'stream');
message = objects.deepClone(message);
message.header.msg_type = 'display_data';
onIopub.handle(message);
assert.equal(outputs[1].output_type, 'display_data');
assert.strictEqual(outputs[1].output_type, 'display_data');
});
test('stdin should return void if no handler registered', async () => {
@@ -636,8 +636,8 @@ suite('Cell Model', function (): void {
await result;
// And I expect message to have been passed upstream and no message sent from the cell
assert(!isUndefinedOrNull(stdInMessage));
assert.equal(stdInMessage.content.prompt, stdInDefaultMessage.content.prompt);
assert.equal(stdInMessage.content.password, stdInDefaultMessage.content.password);
assert.strictEqual(stdInMessage.content.prompt, stdInDefaultMessage.content.prompt);
assert.strictEqual(stdInMessage.content.password, stdInDefaultMessage.content.password);
future.verify(f => f.sendInputReply(TypeMoq.It.isAny()), TypeMoq.Times.never());
});
test('stdin should send default response if there is upstream error', async () => {
@@ -688,7 +688,7 @@ suite('Cell Model', function (): void {
onIopub.handle(message);
//Output array's length should be 1
//'transient' tag should no longer exist in the output
assert.equal(outputs.length, 1);
assert.strictEqual(outputs.length, 1);
assert(isUndefinedOrNull(outputs[0]['transient']));
});
@@ -710,7 +710,7 @@ suite('Cell Model', function (): void {
let cell = factory.createCell(undefined, { notebook: notebookModel, isTrusted: false });
assert(!isUndefinedOrNull(cell.cellGuid));
assert.equal(cell.cellGuid.length, 36);
assert.strictEqual(cell.cellGuid.length, 36);
let cellJson = cell.toJSON();
assert(!isUndefinedOrNull(cellJson.metadata.azdata_cell_guid));
});
@@ -739,7 +739,7 @@ suite('Cell Model', function (): void {
let cell = factory.createCell(undefined, { notebook: notebookModel, isTrusted: false });
let content = JSON.stringify(cell.toJSON(), undefined, ' ');
let contentSplit = content.split('\n');
assert.equal(contentSplit.length, 9);
assert.strictEqual(contentSplit.length, 9);
assert(contentSplit[0].trim().startsWith('{'));
assert(contentSplit[1].trim().startsWith('"cell_type": "code",'));
assert(contentSplit[2].trim().startsWith('"source": ""'));
@@ -1038,7 +1038,7 @@ suite('Cell Model', function (): void {
metadata: { connection_name: connectionName }
};
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
assert.equal(model.savedConnectionName, connectionName);
assert.strictEqual(model.savedConnectionName, connectionName);
});
test('Should read attachments name from notebook attachments', async function () {
@@ -1054,10 +1054,10 @@ suite('Cell Model', function (): void {
attachments: cellAttachment
};
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
assert.deepEqual(model.attachments, contents.attachments, 'Attachments do not match in cellModel');
assert.deepStrictEqual(model.attachments, contents.attachments, 'Attachments do not match in cellModel');
let serializedCell = model.toJSON();
assert.deepEqual(serializedCell.attachments, cellAttachment, 'Cell attachment from JSON is incorrect');
assert.deepStrictEqual(serializedCell.attachments, cellAttachment, 'Cell attachment from JSON is incorrect');
});
test('Should not include attachments in notebook json if no attachments exist', async function () {
@@ -1071,10 +1071,10 @@ suite('Cell Model', function (): void {
source: ''
};
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
assert.deepEqual(model.attachments, undefined, 'Cell model attachments should return undefined if they do not exist');
assert.deepStrictEqual(model.attachments, undefined, 'Cell model attachments should return undefined if they do not exist');
let serializedCell = model.toJSON();
assert.deepEqual(serializedCell.attachments, undefined, 'JSON should not include attachments if attachments do not exist');
assert.deepStrictEqual(serializedCell.attachments, undefined, 'JSON should not include attachments if attachments do not exist');
});
test('Should not have cache chart data after new cell created', async function () {
@@ -1088,7 +1088,7 @@ suite('Cell Model', function (): void {
source: ''
};
let cellModel = factory.createCell(contents, { notebook: notebookModel, isTrusted: false }) as CellModel;
assert.deepEqual(cellModel.previousChartState, [], 'New cell should have no previous chart state');
assert.deepStrictEqual(cellModel.previousChartState, [], 'New cell should have no previous chart state');
});
test('Should not cache chart data after clear output', async function () {
@@ -1122,15 +1122,15 @@ suite('Cell Model', function (): void {
// When I create a cell
let cellModel = factory.createCell(contents, { notebook: notebookModel, isTrusted: false }) as CellModel;
assert.deepEqual(cellModel.previousChartState, [], 'New cell should have no previous chart state');
assert.deepStrictEqual(cellModel.previousChartState, [], 'New cell should have no previous chart state');
// When previous chart state exists
cellModel[<any>'_previousChartState'] = contents.outputs[0].metadata.azdata_chartOptions;
assert.deepEqual(cellModel.previousChartState, contents.outputs[0].metadata.azdata_chartOptions, 'Previous chart state should be returned as is');
assert.deepStrictEqual(cellModel.previousChartState, contents.outputs[0].metadata.azdata_chartOptions, 'Previous chart state should be returned as is');
// When cell outputs are cleared
cellModel.clearOutputs();
assert.deepEqual(cellModel.previousChartState, [], 'Previous chart state should be erased after clearing outputs');
assert.deepStrictEqual(cellModel.previousChartState, [], 'Previous chart state should be erased after clearing outputs');
// Put previous chart state back
cellModel[<any>'_previousChartState'] = contents.outputs[0].metadata.azdata_chartOptions;
@@ -1141,7 +1141,7 @@ suite('Cell Model', function (): void {
// When output is generated
cellModel.setFuture(future.object);
await onIopub.handle({ channel: 'iopub', content: { data: 'Hello' }, type: 'execute_reply', metadata: contents.outputs[0].metadata, header: { msg_type: 'execute_result' } });
assert.deepEqual(cellModel.previousChartState, [], 'Previous chart state should not exist after cell source change');
assert.deepStrictEqual(cellModel.previousChartState, [], 'Previous chart state should not exist after cell source change');
// Put previous chart state back
cellModel[<any>'_previousChartState'] = contents.outputs[0].metadata.azdata_chartOptions;
@@ -1149,7 +1149,7 @@ suite('Cell Model', function (): void {
// When output is generated
cellModel.setFuture(future.object);
await onIopub.handle({ channel: 'iopub', content: { data: 'Hello' }, type: 'execute_reply', metadata: contents.outputs[0].metadata, header: { msg_type: 'execute_result' } });
assert.deepEqual(cellModel.previousChartState, contents.outputs[0].metadata.azdata_chartOptions, 'Previous chart state should exist after output is generated');
assert.deepStrictEqual(cellModel.previousChartState, contents.outputs[0].metadata.azdata_chartOptions, 'Previous chart state should exist after output is generated');
});
test('Should read attachments from cell contents', async function () {
@@ -1167,7 +1167,7 @@ suite('Cell Model', function (): void {
attachments: attachments
};
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
assert.equal(model.attachments, attachments);
assert.strictEqual(model.attachments, attachments);
});
test('addAttachment should add a valid attachment to cell', async function () {
@@ -1187,10 +1187,10 @@ suite('Cell Model', function (): void {
};
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
model.addAttachment('image/png', imageFilebase64Value, 'test.png');
assert.deepEqual(model.attachments, attachments);
assert.deepStrictEqual(model.attachments, attachments);
attachments = { 'test.png': testImageAttachment, 'test1.png': testImageAttachment };
model.addAttachment('image/png', imageFilebase64Value, 'test1.png');
assert.deepEqual(model.attachments, attachments, 'addAttachment should add unique images');
assert.deepStrictEqual(model.attachments, attachments, 'addAttachment should add unique images');
});
test('addAttachment should not add an invalid attachment to cell', async function () {
@@ -1207,7 +1207,7 @@ suite('Cell Model', function (): void {
};
let cellModel = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
cellModel.addAttachment('image/png', imageFilebase64Value, 'test.png');
assert.equal(cellModel.attachments, undefined);
assert.strictEqual(cellModel.attachments, undefined);
});
test('addAttachment should not add a duplicate attachment to cell', async function () {
@@ -1227,8 +1227,8 @@ suite('Cell Model', function (): void {
};
let cellModel = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
cellModel.addAttachment('image/png', imageFilebase64Value, 'test.png');
assert.deepEqual(cellModel.attachments, attachments);
assert.deepStrictEqual(cellModel.attachments, attachments);
cellModel.addAttachment('image/png', imageFilebase64Value, 'test.png');
assert.deepEqual(cellModel.attachments, attachments, 'addAttachment should not add duplicate images');
assert.deepStrictEqual(cellModel.attachments, attachments, 'addAttachment should not add duplicate images');
});
});

View File

@@ -44,12 +44,12 @@ suite('Client Session', function (): void {
});
test('Should set path, isReady and ready on construction', function (): void {
assert.equal(session.notebookUri, path);
assert.strictEqual(session.notebookUri, path);
assert(!isUndefinedOrNull(session.ready));
assert(!session.isReady);
assert.equal(session.status, 'starting');
assert.strictEqual(session.status, 'starting');
assert(!session.isInErrorState);
assert.equal(session.errorMessage, '');
assert.strictEqual(session.errorMessage, '');
});
test('Should call on serverManager startup if set', async function (): Promise<void> {
@@ -79,7 +79,7 @@ suite('Client Session', function (): void {
assert(session.isReady);
assert(serverManager.calledStart);
assert(session.isInErrorState);
assert.equal(session.errorMessage, 'error');
assert.strictEqual(session.errorMessage, 'error');
});
test('Should be ready when session manager is ready', async function (): Promise<void> {
@@ -130,7 +130,7 @@ suite('Client Session', function (): void {
// Then
assert(session.isReady);
assert(session.isInErrorState);
assert.equal(session.errorMessage, 'error');
assert.strictEqual(session.errorMessage, 'error');
});
test('Should start session automatically if kernel preference requests it', async function (): Promise<void> {
@@ -145,10 +145,10 @@ suite('Client Session', function (): void {
await session.initialize();
// Then
assert.equal(session.isReady, true, 'Session is not ready');
assert.equal(session.isInErrorState, false, 'Session should not be in error state');
assert.equal(startOptions.kernelName, 'python', 'Session not started with python by default');
assert.equal(startOptions.path, path.fsPath, 'Session start path is incorrect');
assert.strictEqual(session.isReady, true, 'Session is not ready');
assert.strictEqual(session.isInErrorState, false, 'Session should not be in error state');
assert.strictEqual(startOptions.kernelName, 'python', 'Session not started with python by default');
assert.strictEqual(startOptions.path, path.fsPath, 'Session start path is incorrect');
});
test('Should shutdown session even if no serverManager is set', async function (): Promise<void> {

View File

@@ -41,12 +41,12 @@ let expectedNotebookContent: nb.INotebookContents = {
let notebookContentString = JSON.stringify(expectedNotebookContent);
function verifyMatchesExpectedNotebook(notebook: nb.INotebookContents): void {
assert.equal(notebook.cells.length, 1, 'Expected 1 cell');
assert.equal(notebook.cells[0].cell_type, CellTypes.Code);
assert.equal(notebook.cells[0].source, expectedNotebookContent.cells[0].source);
assert.equal(notebook.metadata.kernelspec.name, expectedNotebookContent.metadata.kernelspec.name);
assert.equal(notebook.nbformat, expectedNotebookContent.nbformat);
assert.equal(notebook.nbformat_minor, expectedNotebookContent.nbformat_minor);
assert.strictEqual(notebook.cells.length, 1, 'Expected 1 cell');
assert.strictEqual(notebook.cells[0].cell_type, CellTypes.Code);
assert.strictEqual(notebook.cells[0].source, expectedNotebookContent.cells[0].source);
assert.strictEqual(notebook.metadata.kernelspec.name, expectedNotebookContent.metadata.kernelspec.name);
assert.strictEqual(notebook.nbformat, expectedNotebookContent.nbformat);
assert.strictEqual(notebook.nbformat_minor, expectedNotebookContent.nbformat_minor);
}
suite('Local Content Manager', function (): void {
@@ -136,23 +136,23 @@ suite('Local Content Manager', function (): void {
let notebook = await contentManager.getNotebookContents(URI.file(localFile));
// then I expect output to have been normalized into a single string
let displayOutput = <nb.IDisplayData>notebook.cells[0].outputs[0];
assert.equal(displayOutput.data['text/html'], '<div></div>');
assert.strictEqual(displayOutput.data['text/html'], '<div></div>');
});
test('Should create a new empty notebook if content is undefined', async function (): Promise<void> {
// verify that when loading content from an empty string, a new notebook is created.
let content = await contentManager.loadFromContentString(undefined);
assert.equal(content.metadata, undefined, 'Verify that metadata is undefined');
assert.strictEqual(content.metadata, undefined, 'Verify that metadata is undefined');
// verify that the notebook is empty
assert.equal(content.cells.length, 0, 'Notebook should be empty, so the number of cells should be 0');
assert.strictEqual(content.cells.length, 0, 'Notebook should be empty, so the number of cells should be 0');
});
test('Should create a new empty notebook if content is an empty string', async function (): Promise<void> {
// verify that when loading content from an empty string, a new notebook is created.
let content = await contentManager.loadFromContentString('');
assert.equal(content.metadata, undefined, 'Verify that metadata is undefined');
assert.strictEqual(content.metadata, undefined, 'Verify that metadata is undefined');
// verify that the notebook is empty
assert.equal(content.cells.length, 0, 'Notebook should be empty, so the number of cells should be 0');
assert.strictEqual(content.cells.length, 0, 'Notebook should be empty, so the number of cells should be 0');
});
test('Should create a markdown cell', async function (): Promise<void> {
@@ -176,9 +176,9 @@ suite('Local Content Manager', function (): void {
let notebook = await contentManager.loadFromContentString(markdownNotebookContent);
// assert that markdown cell is supported by
// verifying the notebook matches the expectedNotebookMarkdownContent format
assert.equal(notebook.cells.length, 1, 'The number of cells should be equal to 1');
assert.equal(notebook.cells[0].cell_type, CellTypes.Markdown, 'The cell type should be markdown');
assert.equal(notebook.cells[0].source, expectedNotebookMarkdownContent.cells[0].source, 'The content of the cell must match the expectedNotebookMarkdownContent');
assert.strictEqual(notebook.cells.length, 1, 'The number of cells should be equal to 1');
assert.strictEqual(notebook.cells[0].cell_type, CellTypes.Markdown, 'The cell type should be markdown');
assert.strictEqual(notebook.cells[0].source, expectedNotebookMarkdownContent.cells[0].source, 'The content of the cell must match the expectedNotebookMarkdownContent');
});
test('Should allow stream for output types', async function (): Promise<void> {
@@ -208,7 +208,7 @@ suite('Local Content Manager', function (): void {
let streamOutputContent = JSON.stringify(expectedNotebookStreamOutputContent);
// Verify that the stream output type is supported
let notebook = await contentManager.loadFromContentString(streamOutputContent);
assert.equal(notebook.cells[0].outputs[0].output_type, 'stream', 'Cell output from notebook should be stream');
assert.equal(notebook.cells[0].cell_type, expectedNotebookStreamOutputContent.cells[0].cell_type, 'Cell type of notebook should match the expectedNotebookStreamOutputContent');
assert.strictEqual(notebook.cells[0].outputs[0].output_type, 'stream', 'Cell output from notebook should be stream');
assert.strictEqual(notebook.cells[0].cell_type, expectedNotebookStreamOutputContent.cells[0].cell_type, 'Cell type of notebook should match the expectedNotebookStreamOutputContent');
});
});

View File

@@ -179,9 +179,9 @@ suite('Notebook Editor Model', function (): void {
let notebookEditorModel = await createTextEditorModel(this);
notebookEditorModel.replaceEntireTextEditorModel(notebookModel, undefined);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineCount(), 6);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(5), ' "cells": []');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(2), ' "metadata": {},');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineCount(), 6);
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(5), ' "cells": []');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(2), ' "metadata": {},');
});
test('should replace entire text model for add cell (0 -> 1 cells)', async function (): Promise<void> {
@@ -200,11 +200,11 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert(notebookEditorModel.lastEditFullReplacement);
});
@@ -224,7 +224,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
newCell.executionCount = 1;
contentChange = {
@@ -235,11 +235,11 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 1');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 1');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -251,7 +251,7 @@ suite('Notebook Editor Model', function (): void {
};
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 10');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 10');
assert(!notebookEditorModel.lastEditFullReplacement);
newCell.executionCount = 15;
@@ -262,7 +262,7 @@ suite('Notebook Editor Model', function (): void {
};
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 15');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 15');
assert(!notebookEditorModel.lastEditFullReplacement);
newCell.executionCount = 105;
@@ -273,7 +273,7 @@ suite('Notebook Editor Model', function (): void {
};
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 105');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 105');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -292,7 +292,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
contentChange = {
changeType: NotebookChangeType.CellOutputCleared,
@@ -302,11 +302,11 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputCleared);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -326,7 +326,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
contentChange = {
changeType: NotebookChangeType.CellSourceUpdated,
@@ -344,15 +344,15 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "Line 2 test\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' "Line 3 test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(27), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "Line 2 test\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' "Line 3 test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(27), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -372,7 +372,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
contentChange = {
changeType: NotebookChangeType.CellSourceUpdated,
@@ -390,13 +390,13 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -416,7 +416,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
newCell.source = 'This is a test';
@@ -431,13 +431,13 @@ suite('Notebook Editor Model', function (): void {
assert(!notebookEditorModel.lastEditFullReplacement, 'should not do a full replacement for a source update');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
});
@@ -456,7 +456,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
newCell.source = 'This is a test' + os.EOL + 'Line 2 test' + os.EOL + 'Line 3 test';
@@ -471,15 +471,15 @@ suite('Notebook Editor Model', function (): void {
assert(!notebookEditorModel.lastEditFullReplacement, 'should not do a full replacement for a source update');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "Line 2 test\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' "Line 3 test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(27), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "Line 2 test\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' "Line 3 test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(27), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), ' }');
});
test('should not replace entire text model for single line source change then delete', async function (): Promise<void> {
@@ -497,10 +497,10 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
contentChange = {
changeType: NotebookChangeType.CellSourceUpdated,
@@ -535,13 +535,13 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -560,7 +560,7 @@ suite('Notebook Editor Model', function (): void {
};
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
contentChange = {
changeType: NotebookChangeType.CellSourceUpdated,
@@ -579,12 +579,12 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
assert(!notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "Line 2 test\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' "Line 3 test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "This is a test\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "Line 2 test\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' "Line 3 test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
contentChange = {
changeType: NotebookChangeType.CellSourceUpdated,
@@ -603,10 +603,10 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
assert(!notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "Tt"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "Tt"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
});
test('should not replace entire text model and affect only edited cell', async function (): Promise<void> {
@@ -651,16 +651,16 @@ suite('Notebook Editor Model', function (): void {
assert(!notebookEditorModel.lastEditFullReplacement);
for (let i = 0; i < 10; i++) {
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8 + i * 21), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8 + i * 21), ' "source": [');
if (i === 7) {
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21), ' "This is a test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12 + i * 21), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21), ' "This is a test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12 + i * 21), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
} else {
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21), ' ""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21), ' ""');
}
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10 + i * 21), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14 + i * 21), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25 + i * 21), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10 + i * 21), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14 + i * 21), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25 + i * 21), ' "execution_count": null');
assert(notebookEditorModel.editorModel.textEditorModel.getLineContent(26 + i * 21).startsWith(' }'));
}
});
@@ -680,7 +680,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
newCell[<any>'_outputs'] = newCell.outputs.concat(newCell.outputs);
@@ -691,14 +691,14 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(23), '}, {');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(31), '}');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(32), '],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(33), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(34), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(23), '}, {');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(31), '}');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(32), '],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(33), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(34), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -717,7 +717,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
// First update the model with unmatched brackets
let newUnmatchedBracketOutput: nb.IStreamResult = { output_type: 'stream', name: 'stdout', text: '[0em' };
@@ -730,14 +730,14 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' "text": "[0em"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(27), '}');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), '],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(29), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(30), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' "text": "[0em"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(27), '}');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), '],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(29), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(30), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -752,13 +752,13 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(32), ' "text": "test test test"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(33), ' }');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(34), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(35), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(36), ' }');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(37), ' ]');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(38), '}');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(32), ' "text": "test test test"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(33), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(34), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(35), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(36), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(37), ' ]');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(38), '}');
assert(notebookEditorModel.lastEditFullReplacement);
});
@@ -782,7 +782,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
// add output
newCell[<any>'_outputs'] = previousOutputs;
@@ -794,12 +794,12 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(23), '}');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(23), '}');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -813,7 +813,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '"This text is in quotes"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"This text is in quotes\\""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"This text is in quotes\\""');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -828,7 +828,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '""""""""""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"\\"\\"\\"\\"\\"\\"\\"\\"\\""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"\\"\\"\\"\\"\\"\\"\\"\\"\\""');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -843,7 +843,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '\\\\\\\\\\');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\\\\\\\\\\\\\\\\\\\\"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\\\\\\\\\\\\\\\\\\\\"');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -858,7 +858,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '\"\"\"\"\"\"\"\"\"\"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\""');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -873,7 +873,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, 'this is a long line in a cell test. Everything should serialize correctly! # Comments here: adding more tests is fun?');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "this is a long line in a cell test. Everything should serialize correctly! # Comments here: adding more tests is fun?"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "this is a long line in a cell test. Everything should serialize correctly! # Comments here: adding more tests is fun?"');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -888,7 +888,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '`~1!2@3#4$5%6^7&8*9(0)-_=+[{]}\\|;:",<.>/?\'');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "`~1!2@3#4$5%6^7&8*9(0)-_=+[{]}\\\\|;:\\",<.>/?\'"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "`~1!2@3#4$5%6^7&8*9(0)-_=+[{]}\\\\|;:\\",<.>/?\'"');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -903,7 +903,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '\'\'\'\'');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\'\'\'\'"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\'\'\'\'"');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -918,7 +918,7 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
assert(!notebookEditorModel.lastEditFullReplacement);
@@ -933,15 +933,15 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '"test"' + os.EOL + 'test""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"test\\"\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"test\\"\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "test\\"\\""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(13), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "outputs": [],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(17), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "test\\"\\""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(13), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "outputs": [],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(17), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -955,15 +955,15 @@ suite('Notebook Editor Model', function (): void {
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '"""""test"' + os.EOL + '"""""""test\\""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"\\"\\"\\"\\"test\\"\\n",');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"\\"\\"\\"\\"test\\"\\n",');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "\\"\\"\\"\\"\\"\\"\\"test\\\\\\"\\""');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(13), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "outputs": [],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(17), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' "\\"\\"\\"\\"\\"\\"\\"test\\\\\\"\\""');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(11), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(13), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "outputs": [],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(17), ' }');
assert(!notebookEditorModel.lastEditFullReplacement);
});
@@ -996,7 +996,7 @@ suite('Notebook Editor Model', function (): void {
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
assert(notebookEditorModel.lastEditFullReplacement);
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
}
function addTextToBeginningOfTextEditorModel(notebookEditorModel: NotebookEditorModel, newCell: ICellModel, textToAdd: string) {
@@ -1018,11 +1018,11 @@ suite('Notebook Editor Model', function (): void {
}
function ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel: NotebookEditorModel, newCell: ICellModel) {
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "execution_count": null');
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' }');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(8), ' "source": [');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(10), ' ],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(12), ' "azdata_cell_guid": "' + newCell.cellGuid + '"');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(15), ' "execution_count": null');
assert.strictEqual(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' }');
}
});

View File

@@ -119,15 +119,15 @@ suite('Notebook Find Model', function (): void {
test('Should set notebook model on initialize', async function (): Promise<void> {
//initialize find
let notebookFindModel = new NotebookFindModel(model);
assert.equal(notebookFindModel.notebookModel, model, 'Failed to set notebook model');
assert.strictEqual(notebookFindModel.notebookModel, model, 'Failed to set notebook model');
});
test('Should have no decorations on initialize', async function (): Promise<void> {
//initialize find
let notebookFindModel = new NotebookFindModel(model);
assert.equal(notebookFindModel.findDecorations, undefined, 'findDecorations should be undefined on initialize');
assert.equal(notebookFindModel.getPosition(), undefined, 'currentMatch should be undefined on initialize');
assert.equal(notebookFindModel.getLastPosition(), undefined, 'previousMatch should be undefined on initialize');
assert.strictEqual(notebookFindModel.findDecorations, undefined, 'findDecorations should be undefined on initialize');
assert.strictEqual(notebookFindModel.getPosition(), undefined, 'currentMatch should be undefined on initialize');
assert.strictEqual(notebookFindModel.getLastPosition(), undefined, 'previousMatch should be undefined on initialize');
});
test('Should find results in the notebook', async function (): Promise<void> {
@@ -139,9 +139,9 @@ suite('Notebook Find Model', function (): void {
await notebookFindModel.find('markdown', false, false, max_find_count);
assert(notebookFindModel.findMatches, 'Find in notebook failed.');
assert.equal(notebookFindModel.findMatches.length, 2, 'Find could not find all occurrences');
assert.equal(notebookFindModel.findArray.length, 2, 'Find could not find all occurrences');
assert.equal(notebookFindModel.getFindCount(), 2, 'Find count do not match find results');
assert.strictEqual(notebookFindModel.findMatches.length, 2, 'Find could not find all occurrences');
assert.strictEqual(notebookFindModel.findArray.length, 2, 'Find could not find all occurrences');
assert.strictEqual(notebookFindModel.getFindCount(), 2, 'Find count do not match find results');
});
test('Should not find results in the notebook', async function (): Promise<void> {
@@ -149,7 +149,7 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('notFound', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 0, 'Find failed');
assert.strictEqual(notebookFindModel.findMatches.length, 0, 'Find failed');
});
test('Should match find result ranges', async function (): Promise<void> {
@@ -160,10 +160,10 @@ suite('Notebook Find Model', function (): void {
await notebookFindModel.find('markdown', false, false, max_find_count);
let expectedFindRange1 = new NotebookRange(model.cells[0], 2, 13, 2, 21);
assert.deepEqual(notebookFindModel.findMatches[0].range, expectedFindRange1, 'Find in markdown range is wrong :\n' + JSON.stringify(expectedFindRange1) + '\n ' + JSON.stringify(notebookFindModel.findMatches[0].range));
assert.deepStrictEqual(notebookFindModel.findMatches[0].range, expectedFindRange1, 'Find in markdown range is wrong :\n' + JSON.stringify(expectedFindRange1) + '\n ' + JSON.stringify(notebookFindModel.findMatches[0].range));
let expectedFindRange2 = new NotebookRange(model.cells[1], 1, 6, 1, 14);
assert.deepEqual(notebookFindModel.findMatches[1].range, expectedFindRange2, 'Find in markdown range is wrong :\n' + JSON.stringify(expectedFindRange2) + '\n ' + JSON.stringify(notebookFindModel.findMatches[1].range));
assert.deepStrictEqual(notebookFindModel.findMatches[1].range, expectedFindRange2, 'Find in markdown range is wrong :\n' + JSON.stringify(expectedFindRange2) + '\n ' + JSON.stringify(notebookFindModel.findMatches[1].range));
});
test('Should set selection when find matches results', async function (): Promise<void> {
@@ -176,7 +176,7 @@ suite('Notebook Find Model', function (): void {
notebookFindModel.setSelection(notebookFindModel.findMatches[0].range);
let expectedFindRange1 = new NotebookRange(model.cells[0], 2, 13, 2, 21);
assert.deepEqual(notebookFindModel.currentMatch, expectedFindRange1, 'Find failed to set selection on finding results');
assert.deepStrictEqual(notebookFindModel.currentMatch, expectedFindRange1, 'Find failed to set selection on finding results');
});
test('Should ignore hyperlink markdown data and find correctly', async function (): Promise<void> {
@@ -205,10 +205,10 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('best', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 1, 'Find failed on markdown link');
assert.strictEqual(notebookFindModel.findMatches.length, 1, 'Find failed on markdown link');
let expectedFindRange1 = new NotebookRange(model.cells[0], 1, 21, 1, 25);
assert.deepEqual(notebookFindModel.findMatches[0].range, expectedFindRange1, 'Find in markdown range is wrong :\n' + JSON.stringify(expectedFindRange1) + '\n ' + JSON.stringify(notebookFindModel.findMatches[0].range));
assert.deepStrictEqual(notebookFindModel.findMatches[0].range, expectedFindRange1, 'Find in markdown range is wrong :\n' + JSON.stringify(expectedFindRange1) + '\n ' + JSON.stringify(notebookFindModel.findMatches[0].range));
});
@@ -235,7 +235,7 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('x', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 3, 'Find failed');
assert.strictEqual(notebookFindModel.findMatches.length, 3, 'Find failed');
});
test('Should match find results for multiple results on same line', async function (): Promise<void> {
@@ -262,15 +262,15 @@ suite('Notebook Find Model', function (): void {
// Intentionally not using max_find_count here, as 7 items should be found
await notebookFindModel.find('abc', false, false, 10);
assert.equal(notebookFindModel.findMatches.length, 7, 'Find failed to find number of matches correctly');
assert.strictEqual(notebookFindModel.findMatches.length, 7, 'Find failed to find number of matches correctly');
assert.deepEqual(notebookFindModel.findMatches[0].range, new NotebookRange(model.cells[0], 1, 1, 1, 4));
assert.deepEqual(notebookFindModel.findMatches[1].range, new NotebookRange(model.cells[0], 1, 5, 1, 8));
assert.deepEqual(notebookFindModel.findMatches[2].range, new NotebookRange(model.cells[0], 1, 9, 1, 12));
assert.deepEqual(notebookFindModel.findMatches[3].range, new NotebookRange(model.cells[0], 1, 13, 1, 16));
assert.deepEqual(notebookFindModel.findMatches[4].range, new NotebookRange(model.cells[0], 1, 17, 1, 20));
assert.deepEqual(notebookFindModel.findMatches[5].range, new NotebookRange(model.cells[0], 1, 21, 1, 24));
assert.deepEqual(notebookFindModel.findMatches[6].range, new NotebookRange(model.cells[0], 1, 24, 1, 27));
assert.deepStrictEqual(notebookFindModel.findMatches[0].range, new NotebookRange(model.cells[0], 1, 1, 1, 4));
assert.deepStrictEqual(notebookFindModel.findMatches[1].range, new NotebookRange(model.cells[0], 1, 5, 1, 8));
assert.deepStrictEqual(notebookFindModel.findMatches[2].range, new NotebookRange(model.cells[0], 1, 9, 1, 12));
assert.deepStrictEqual(notebookFindModel.findMatches[3].range, new NotebookRange(model.cells[0], 1, 13, 1, 16));
assert.deepStrictEqual(notebookFindModel.findMatches[4].range, new NotebookRange(model.cells[0], 1, 17, 1, 20));
assert.deepStrictEqual(notebookFindModel.findMatches[5].range, new NotebookRange(model.cells[0], 1, 21, 1, 24));
assert.deepStrictEqual(notebookFindModel.findMatches[6].range, new NotebookRange(model.cells[0], 1, 24, 1, 27));
});
@@ -283,10 +283,10 @@ suite('Notebook Find Model', function (): void {
await notebookFindModel.find('insert', false, false, max_find_count);
assert(notebookFindModel.findMatches, 'Find in notebook failed.');
assert.equal(notebookFindModel.findMatches.length, 3, 'Find couldn\'t find all occurrences');
assert.strictEqual(notebookFindModel.findMatches.length, 3, 'Find couldn\'t find all occurrences');
await notebookFindModel.find('insert', true, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 2, 'Find failed to apply match case while searching');
assert.strictEqual(notebookFindModel.findMatches.length, 2, 'Find failed to apply match case while searching');
});
@@ -295,7 +295,7 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('insert', true, true, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 1, 'Find failed to apply whole word filter while searching');
assert.strictEqual(notebookFindModel.findMatches.length, 1, 'Find failed to apply whole word filter while searching');
});
@@ -322,14 +322,14 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
// test for string with special character
await notebookFindModel.find('{special}', true, true, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 1, 'Find failed for search term with special character');
assert.strictEqual(notebookFindModel.findMatches.length, 1, 'Find failed for search term with special character');
// test for only special character !!
await notebookFindModel.find('!!', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 2, 'Find failed for special character');
assert.strictEqual(notebookFindModel.findMatches.length, 2, 'Find failed for special character');
// test for only special character combination
await notebookFindModel.find('!!!$}', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 1, 'Find failed for special character combination');
assert.strictEqual(notebookFindModel.findMatches.length, 1, 'Find failed for special character combination');
});
test('Should find // characters in the search term correctly', async function (): Promise<void> {
@@ -355,13 +355,13 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('/', true, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 2, 'Find failed to find number of / occurrences');
assert.strictEqual(notebookFindModel.findMatches.length, 2, 'Find failed to find number of / occurrences');
await notebookFindModel.find('//', true, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 1, 'Find failed to find number of // occurrences');
assert.strictEqual(notebookFindModel.findMatches.length, 1, 'Find failed to find number of // occurrences');
await notebookFindModel.find('//', true, true, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 0, 'Find failed to apply match whole word for //');
assert.strictEqual(notebookFindModel.findMatches.length, 0, 'Find failed to apply match whole word for //');
});
test('Should find results in the code cell on markdown edit', async function (): Promise<void> {
@@ -390,14 +390,14 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('SOP', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 1, 'Find failed on markdown');
assert.strictEqual(notebookFindModel.findMatches.length, 1, 'Find failed on markdown');
// fire the edit mode on cell
model.cells[0].isEditMode = true;
notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('SOP', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 2, 'Find failed on markdown edit');
assert.strictEqual(notebookFindModel.findMatches.length, 2, 'Find failed on markdown edit');
});
test('Find next/previous should return the correct find index', async function (): Promise<void> {
@@ -408,13 +408,13 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('insert', false, false, max_find_count);
assert.equal(notebookFindModel.getFindIndex(), 1, 'Failed to get the correct find index');
assert.strictEqual(notebookFindModel.getFindIndex(), 1, 'Failed to get the correct find index');
notebookFindModel.findNext();
assert.equal(notebookFindModel.getFindIndex(), 2, 'Failed to get the correct find index');
assert.strictEqual(notebookFindModel.getFindIndex(), 2, 'Failed to get the correct find index');
notebookFindModel.findPrevious();
assert.equal(notebookFindModel.getFindIndex(), 1, 'Failed to get the correct find index');
assert.strictEqual(notebookFindModel.getFindIndex(), 1, 'Failed to get the correct find index');
});
test('Should clear results on clear', async function (): Promise<void> {
@@ -425,11 +425,11 @@ suite('Notebook Find Model', function (): void {
let notebookFindModel = new NotebookFindModel(model);
await notebookFindModel.find('insert', false, false, max_find_count);
assert.equal(notebookFindModel.findMatches.length, 3, 'Failed to find all occurrences');
assert.strictEqual(notebookFindModel.findMatches.length, 3, 'Failed to find all occurrences');
notebookFindModel.clearFind();
assert.equal(notebookFindModel.findMatches.length, 0, 'Failed to clear find results');
assert.equal(notebookFindModel.findDecorations, undefined, 'Failed to clear find decorations on clear');
assert.strictEqual(notebookFindModel.findMatches.length, 0, 'Failed to clear find results');
assert.strictEqual(notebookFindModel.findDecorations, undefined, 'Failed to clear find decorations on clear');
});

View File

@@ -208,7 +208,7 @@ suite('notebook model', function (): void {
await model.loadContents();
// Then I expect to have 0 code cell as the contents
assert.equal(model.cells.length, 0);
assert.strictEqual(model.cells.length, 0);
// And Trust should be true by default if there are no cells
assert(model.trustedMode);
@@ -238,9 +238,9 @@ suite('notebook model', function (): void {
// When I initalize the model
// Then it should throw
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
assert.equal(model.inErrorState, false);
assert.strictEqual(model.inErrorState, false);
await assert.rejects(async () => { await model.loadContents(); });
assert.equal(model.inErrorState, true);
assert.strictEqual(model.inErrorState, true);
});
test('Should convert cell info to CellModels', async function (): Promise<void> {
@@ -254,9 +254,9 @@ suite('notebook model', function (): void {
await model.loadContents();
// Then I expect all cells to be in the model
assert.equal(model.cells.length, 2);
assert.deepEqual(model.cells[0].source, expectedNotebookContent.cells[0].source);
assert.deepEqual(model.cells[1].source, expectedNotebookContent.cells[1].source);
assert.strictEqual(model.cells.length, 2);
assert.deepStrictEqual(model.cells[0].source, expectedNotebookContent.cells[0].source);
assert.deepStrictEqual(model.cells[1].source, expectedNotebookContent.cells[1].source);
});
test('Should handle multiple notebook managers', async function (): Promise<void> {
@@ -282,7 +282,7 @@ suite('notebook model', function (): void {
await model.loadContents();
// I expect the default provider to be jupyter
assert.equal(model.notebookManager.providerId, 'jupyter', 'Notebook manager provider id incorrect');
assert.strictEqual(model.notebookManager.providerId, 'jupyter', 'Notebook manager provider id incorrect');
// Similarly, change default notebook provider id to SQL
defaultModelOptions.providerId = 'SQL';
@@ -292,18 +292,18 @@ suite('notebook model', function (): void {
await model.loadContents();
// I expect the default provider to be SQL
assert.equal(model.notebookManager.providerId, 'SQL', 'Notebook manager provider id incorrect after 2nd model load');
assert.strictEqual(model.notebookManager.providerId, 'SQL', 'Notebook manager provider id incorrect after 2nd model load');
// Check that the getters return the correct values
assert.equal(model.notebookManagers.length, 2, 'There should be 2 notebook managers');
assert.strictEqual(model.notebookManagers.length, 2, 'There should be 2 notebook managers');
assert(!isUndefinedOrNull(model.getNotebookManager('SQL')), 'SQL notebook manager is not defined');
assert(!isUndefinedOrNull(model.getNotebookManager('jupyter')), 'Jupyter notebook manager is not defined');
assert(isUndefinedOrNull(model.getNotebookManager('foo')), 'foo notebook manager is incorrectly defined');
// Check other properties to ensure that they're returning as expected
// No server manager was passed into the notebook manager stub, so expect hasServerManager to return false
assert.equal(model.hasServerManager, false, 'Notebook model should not have a server manager');
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.hasServerManager, false, 'Notebook model should not have a server manager');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
});
test('Should set active cell correctly', async function (): Promise<void> {
@@ -328,39 +328,39 @@ suite('notebook model', function (): void {
model.contentChanged(c => notebookContentChange = c);
// Then I expect all cells to be in the model
assert.equal(model.cells.length, 2, 'Cell count in notebook model is not correct');
assert.strictEqual(model.cells.length, 2, 'Cell count in notebook model is not correct');
// Set the first cell as active
model.updateActiveCell(model.cells[0]);
assert.deepEqual(model.activeCell, model.cells[0], 'Active cell does not match the first cell');
assert.deepEqual(model.activeCell, activeCellFromEvent, 'Active cell returned from the event does not match');
assert.equal(activeCellChangeCount, 1, 'Active cell change count is incorrect');
assert.deepStrictEqual(model.activeCell, model.cells[0], 'Active cell does not match the first cell');
assert.deepStrictEqual(model.activeCell, activeCellFromEvent, 'Active cell returned from the event does not match');
assert.strictEqual(activeCellChangeCount, 1, 'Active cell change count is incorrect');
assert(isUndefinedOrNull(notebookContentChange), 'Content change should be undefined');
// Set the second cell as active
model.updateActiveCell(model.cells[1]);
assert.deepEqual(model.activeCell, model.cells[1], 'Active cell does not match expected value');
assert.deepEqual(model.activeCell, activeCellFromEvent, 'Active cell returned from the event does not match (2nd)');
assert.equal(activeCellChangeCount, 2, 'Active cell change count is incorrect; should be 2');
assert.deepStrictEqual(model.activeCell, model.cells[1], 'Active cell does not match expected value');
assert.deepStrictEqual(model.activeCell, activeCellFromEvent, 'Active cell returned from the event does not match (2nd)');
assert.strictEqual(activeCellChangeCount, 2, 'Active cell change count is incorrect; should be 2');
// Delete the active cell
model.deleteCell(model.cells[1]);
assert(isUndefinedOrNull(model.activeCell), 'Active cell should be undefined after active cell is deleted');
assert.deepEqual(model.activeCell, activeCellFromEvent, 'Active cell should match value from event');
assert.equal(activeCellChangeCount, 3, 'Active cell change count is incorrect; should be 3');
assert.deepStrictEqual(model.activeCell, activeCellFromEvent, 'Active cell should match value from event');
assert.strictEqual(activeCellChangeCount, 3, 'Active cell change count is incorrect; should be 3');
// Set the remaining cell as active
model.updateActiveCell(model.cells[0]);
assert.deepEqual(model.activeCell, activeCellFromEvent, 'Active cell should match value from event');
assert.equal(activeCellChangeCount, 4, 'Active cell change count is incorrect; should be 4');
assert.deepStrictEqual(model.activeCell, activeCellFromEvent, 'Active cell should match value from event');
assert.strictEqual(activeCellChangeCount, 4, 'Active cell change count is incorrect; should be 4');
// Add new cell
let newCell = model.addCell(CellTypes.Code, 0);
// Ensure new cell is active cell
assert.deepEqual(model.activeCell, newCell, 'Active cell does not match newly created cell');
assert.equal(activeCellChangeCount, 5, 'Active cell change count is incorrect; should be 5');
assert.deepStrictEqual(model.activeCell, newCell, 'Active cell does not match newly created cell');
assert.strictEqual(activeCellChangeCount, 5, 'Active cell change count is incorrect; should be 5');
});
test('Should set notebook parameter and injected parameter cell correctly', async function (): Promise<void> {
@@ -373,22 +373,22 @@ suite('notebook model', function (): void {
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
await model.loadContents();
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.equal(model.cells.length, 2, 'Cell count in notebook model is not correct');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.cells.length, 2, 'Cell count in notebook model is not correct');
// Set parameter cell and injected parameters cell
let notebookParamsCell = model.cells[0];
let notebookInjectedParamsCell = model.cells[1];
// Parameters Cell Validation
assert.equal(model.cells.indexOf(notebookParamsCell), 0, 'Notebook parameters cell should be first cell in notebook');
assert.equal(notebookParamsCell.isParameter, true, 'Notebook parameters cell should be tagged parameter');
assert.equal(notebookParamsCell.isInjectedParameter, false, 'Notebook parameters cell should not be tagged injected parameter');
assert.strictEqual(model.cells.indexOf(notebookParamsCell), 0, 'Notebook parameters cell should be first cell in notebook');
assert.strictEqual(notebookParamsCell.isParameter, true, 'Notebook parameters cell should be tagged parameter');
assert.strictEqual(notebookParamsCell.isInjectedParameter, false, 'Notebook parameters cell should not be tagged injected parameter');
// Injected Parameters Cell Validation
assert.equal(model.cells.indexOf(notebookInjectedParamsCell), 1, 'Notebook injected parameters cell should be second cell in notebook');
assert.equal(notebookInjectedParamsCell.isParameter, false, 'Notebook injected parameters cell should not be tagged parameter cell');
assert.equal(notebookInjectedParamsCell.isInjectedParameter, true, 'Notebook injected parameters cell should be tagged injected parameter');
assert.strictEqual(model.cells.indexOf(notebookInjectedParamsCell), 1, 'Notebook injected parameters cell should be second cell in notebook');
assert.strictEqual(notebookInjectedParamsCell.isParameter, false, 'Notebook injected parameters cell should not be tagged parameter cell');
assert.strictEqual(notebookInjectedParamsCell.isInjectedParameter, true, 'Notebook injected parameters cell should be tagged injected parameter');
});
test('Should set notebookUri parameters to new cell correctly', async function (): Promise<void> {
@@ -401,14 +401,14 @@ suite('notebook model', function (): void {
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
await model.loadContents();
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.equal(model.cells.length, 2, 'Cell count in notebook model is not correct');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.cells.length, 2, 'Cell count in notebook model is not correct');
// Validate notebookUri parameter cell is set as the only parameter cell
let notebookUriParamsCell = model.cells[0];
assert.equal(model.cells.indexOf(notebookUriParamsCell), 0, 'NotebookURI parameters cell should be first cell in notebook');
assert.equal(notebookUriParamsCell.isParameter, true, 'NotebookURI parameters cell should be tagged parameter');
assert.equal(notebookUriParamsCell.isInjectedParameter, false, 'NotebookURI parameters Cell should not be injected parameter');
assert.strictEqual(model.cells.indexOf(notebookUriParamsCell), 0, 'NotebookURI parameters cell should be first cell in notebook');
assert.strictEqual(notebookUriParamsCell.isParameter, true, 'NotebookURI parameters cell should be tagged parameter');
assert.strictEqual(notebookUriParamsCell.isInjectedParameter, false, 'NotebookURI parameters Cell should not be injected parameter');
});
test('Should set notebookUri parameters to new cell after parameters cell correctly', async function (): Promise<void> {
@@ -425,14 +425,14 @@ suite('notebook model', function (): void {
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
await model.loadContents();
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.equal(model.cells.length, 2, 'Cell count in notebook model is not correct');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.cells.length, 2, 'Cell count in notebook model is not correct');
// Validate notebookUri parameter cell is set as injected parameter
let notebookUriParamsCell = model.cells[1];
assert.equal(model.cells.indexOf(notebookUriParamsCell), 1, 'NotebookURI parameters cell should be second cell in notebook');
assert.equal(notebookUriParamsCell.isParameter, false, 'NotebookURI parameters cell should not be tagged parameter cell');
assert.equal(notebookUriParamsCell.isInjectedParameter, true, 'NotebookURI parameters Cell should be injected parameter');
assert.strictEqual(model.cells.indexOf(notebookUriParamsCell), 1, 'NotebookURI parameters cell should be second cell in notebook');
assert.strictEqual(notebookUriParamsCell.isParameter, false, 'NotebookURI parameters cell should not be tagged parameter cell');
assert.strictEqual(notebookUriParamsCell.isInjectedParameter, true, 'NotebookURI parameters Cell should be injected parameter');
});
test('Should set notebookUri parameters to new cell after injected parameters cell correctly', async function (): Promise<void> {
@@ -446,14 +446,14 @@ suite('notebook model', function (): void {
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
await model.loadContents();
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.equal(model.cells.length, 3, 'Cell count in notebook model is not correct');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.cells.length, 3, 'Cell count in notebook model is not correct');
// Validate notebookUri parameter cell is set as an injected parameter after parameter and injected parameter cells
let notebookUriParamsCell = model.cells[2];
assert.equal(model.cells.indexOf(notebookUriParamsCell), 2, 'NotebookURI parameters cell should be third cell in notebook');
assert.equal(notebookUriParamsCell.isParameter, false, 'NotebookURI parameters cell should not be tagged parameter cell');
assert.equal(notebookUriParamsCell.isInjectedParameter, true, 'NotebookURI parameters Cell should be injected parameter');
assert.strictEqual(model.cells.indexOf(notebookUriParamsCell), 2, 'NotebookURI parameters cell should be third cell in notebook');
assert.strictEqual(notebookUriParamsCell.isParameter, false, 'NotebookURI parameters cell should not be tagged parameter cell');
assert.strictEqual(notebookUriParamsCell.isInjectedParameter, true, 'NotebookURI parameters Cell should be injected parameter');
});
test('Should move first cell below second cell correctly', async function (): Promise<void> {
@@ -465,15 +465,15 @@ suite('notebook model', function (): void {
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
await model.loadContents();
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.equal(model.cells.length, 2, 'Cell count in notebook model is not correct');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.cells.length, 2, 'Cell count in notebook model is not correct');
let firstCell = model.cells[0];
let secondCell = model.cells[1];
// Move First Cell down
model.moveCell(firstCell, 1);
assert.equal(model.cells.indexOf(firstCell), 1, 'First Cell did not move down correctly');
assert.equal(model.cells.indexOf(secondCell), 0, 'Second Cell did not move up correctly');
assert.strictEqual(model.cells.indexOf(firstCell), 1, 'First Cell did not move down correctly');
assert.strictEqual(model.cells.indexOf(secondCell), 0, 'Second Cell did not move up correctly');
});
test('Should move second cell up above the first cell correctly', async function (): Promise<void> {
@@ -485,15 +485,15 @@ suite('notebook model', function (): void {
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
await model.loadContents();
assert.equal(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.equal(model.cells.length, 2, 'Cell count in notebook model is not correct');
assert.strictEqual(model.notebookUri, defaultModelOptions.notebookUri, 'Notebook model has incorrect URI');
assert.strictEqual(model.cells.length, 2, 'Cell count in notebook model is not correct');
let firstCell = model.cells[0];
let secondCell = model.cells[1];
// Move Second Cell up
model.moveCell(secondCell, 0);
assert.equal(model.cells.indexOf(firstCell), 1, 'First Cell did not move down correctly');
assert.equal(model.cells.indexOf(secondCell), 0, 'Second Cell did not move up correctly');
assert.strictEqual(model.cells.indexOf(firstCell), 1, 'First Cell did not move down correctly');
assert.strictEqual(model.cells.indexOf(secondCell), 0, 'Second Cell did not move up correctly');
});
test('Should delete cells correctly', async function (): Promise<void> {
@@ -513,38 +513,38 @@ suite('notebook model', function (): void {
model.contentChanged(c => notebookContentChange = c);
// Then I expect all cells to be in the model
assert.equal(model.cells.length, 2, 'Cell count in model is incorrect');
assert.strictEqual(model.cells.length, 2, 'Cell count in model is incorrect');
assert.equal(model.findCellIndex(model.cells[0]), 0, 'findCellIndex returned wrong cell info for first cell');
assert.equal(model.findCellIndex(model.cells[1]), 1, 'findCellIndex returned wrong cell info for second cell');
assert.strictEqual(model.findCellIndex(model.cells[0]), 0, 'findCellIndex returned wrong cell info for first cell');
assert.strictEqual(model.findCellIndex(model.cells[1]), 1, 'findCellIndex returned wrong cell info for second cell');
// Delete the first cell
model.deleteCell(model.cells[0]);
assert.equal(model.cells.length, 1, 'Cell model length should be 1 after cell deletion');
assert.deepEqual(model.cells[0].source, expectedNotebookContent.cells[1].source, 'Expected cell source is incorrect');
assert.equal(model.findCellIndex(model.cells[0]), 0, 'findCellIndex returned wrong cell info for only remaining cell');
assert.equal(notebookContentChange.changeType, NotebookChangeType.CellsModified, 'notebookContentChange changeType is incorrect');
assert.equal(notebookContentChange.isDirty, true, 'notebookContentChange should set dirty flag');
assert.equal(model.activeCell, undefined, 'active cell is not undefined');
assert.strictEqual(model.cells.length, 1, 'Cell model length should be 1 after cell deletion');
assert.deepStrictEqual(model.cells[0].source, expectedNotebookContent.cells[1].source, 'Expected cell source is incorrect');
assert.strictEqual(model.findCellIndex(model.cells[0]), 0, 'findCellIndex returned wrong cell info for only remaining cell');
assert.strictEqual(notebookContentChange.changeType, NotebookChangeType.CellsModified, 'notebookContentChange changeType is incorrect');
assert.strictEqual(notebookContentChange.isDirty, true, 'notebookContentChange should set dirty flag');
assert.strictEqual(model.activeCell, undefined, 'active cell is not undefined');
// Delete the remaining cell
notebookContentChange = undefined;
model.deleteCell(model.cells[0]);
assert.equal(model.cells.length, 0, 'There should be no cells tracked in the notebook model');
assert.equal(model.findCellIndex(model.cells[0]), -1, 'findCellIndex is incorrectly finding a deleted cell');
assert.equal(errorCount, 0, 'There should be no errors after deleting a cell that exists');
assert.equal(notebookContentChange.changeType, NotebookChangeType.CellsModified, 'notebookContentChange changeType should indicate CellsModified');
assert.equal(model.activeCell, undefined, 'Active cell should be undefined');
assert.strictEqual(model.cells.length, 0, 'There should be no cells tracked in the notebook model');
assert.strictEqual(model.findCellIndex(model.cells[0]), -1, 'findCellIndex is incorrectly finding a deleted cell');
assert.strictEqual(errorCount, 0, 'There should be no errors after deleting a cell that exists');
assert.strictEqual(notebookContentChange.changeType, NotebookChangeType.CellsModified, 'notebookContentChange changeType should indicate CellsModified');
assert.strictEqual(model.activeCell, undefined, 'Active cell should be undefined');
// Try deleting the cell again
notebookContentChange = undefined;
model.deleteCell(model.cells[0]);
assert.equal(errorCount, 1, 'The model should record an error after trying to delete a cell that does not exist');
assert.strictEqual(errorCount, 1, 'The model should record an error after trying to delete a cell that does not exist');
assert(isUndefinedOrNull(notebookContentChange), 'There should be no content change after an error is recorded');
// Try deleting as notebook model is in error state
notebookContentChange = undefined;
model.deleteCell(model.cells[0]);
assert.equal(errorCount, 2, 'Error count should be 2 after trying to delete a cell that does not exist a second time');
assert.strictEqual(errorCount, 2, 'Error count should be 2 after trying to delete a cell that does not exist a second time');
assert(isUndefinedOrNull(notebookContentChange), 'There still should be no content change after an error is recorded');
});
@@ -562,7 +562,7 @@ suite('notebook model', function (): void {
model.cells[0].metadata = { 'test-field': 'test-value' };
assert(!isUndefinedOrNull(notebookContentChange));
assert.equal(notebookContentChange.changeType, NotebookChangeType.CellMetadataUpdated, 'notebookContentChange changeType should indicate ');
assert.strictEqual(notebookContentChange.changeType, NotebookChangeType.CellMetadataUpdated, 'notebookContentChange changeType should indicate ');
});
test('Should set cell language correctly after cell type conversion', async function (): Promise<void> {
@@ -579,18 +579,18 @@ suite('notebook model', function (): void {
let firstCell = model.cells[0];
let secondCell = model.cells[1];
assert.equal(firstCell.cellType, CellTypes.Code, 'Initial cell type for first cell should be code');
assert.equal(firstCell.language, 'sql', 'Initial language should be sql for first cell');
assert.strictEqual(firstCell.cellType, CellTypes.Code, 'Initial cell type for first cell should be code');
assert.strictEqual(firstCell.language, 'sql', 'Initial language should be sql for first cell');
model.convertCellType(firstCell);
assert.equal(firstCell.cellType, CellTypes.Markdown, 'Failed to convert cell type after conversion');
assert.equal(firstCell.language, 'markdown', 'Language should be markdown for text cells');
assert.deepEqual(newCell, firstCell);
assert.strictEqual(firstCell.cellType, CellTypes.Markdown, 'Failed to convert cell type after conversion');
assert.strictEqual(firstCell.language, 'markdown', 'Language should be markdown for text cells');
assert.deepStrictEqual(newCell, firstCell);
model.convertCellType(secondCell);
assert.equal(secondCell.cellType, CellTypes.Code, 'Failed to convert second cell type');
assert.equal(secondCell.language, 'sql', 'Language should be sql again for second cell');
assert.deepEqual(newCell, secondCell);
assert.strictEqual(secondCell.cellType, CellTypes.Code, 'Failed to convert second cell type');
assert.strictEqual(secondCell.language, 'sql', 'Language should be sql again for second cell');
assert.deepStrictEqual(newCell, secondCell);
});
test('Should load contents but then go to error state if client session startup fails', async function (): Promise<void> {
@@ -610,21 +610,21 @@ suite('notebook model', function (): void {
// Cannot set property 'defaultKernelLoaded' of undefined
await assert.rejects(async () => { await model.startSession(notebookManagers[0]); });
// Then I expect load to succeed
assert.equal(model.cells.length, 1);
assert.strictEqual(model.cells.length, 1);
assert(model.clientSession);
// but on server load completion I expect error state to be set
// Note: do not expect serverLoad event to throw even if failed
await model.sessionLoadFinished;
assert.equal(model.inErrorState, false);
assert.equal(sessionFired, false);
assert.strictEqual(model.inErrorState, false);
assert.strictEqual(sessionFired, false);
});
test('Should not be in error state if client session initialization succeeds', async function (): Promise<void> {
let model = await loadModelAndStartClientSession(expectedNotebookContent);
assert.equal(model.inErrorState, false);
assert.equal(model.notebookManagers.length, 1);
assert.deepEqual(model.clientSession, mockClientSession);
assert.strictEqual(model.inErrorState, false);
assert.strictEqual(model.notebookManagers.length, 1);
assert.deepStrictEqual(model.clientSession, mockClientSession);
});
test('Should notify on trust set', async function () {
@@ -643,7 +643,7 @@ suite('notebook model', function (): void {
// Then content changed notification should be sent
assert(model.trustedMode);
assert(!isUndefinedOrNull(actualChanged));
assert.equal(actualChanged.changeType, NotebookChangeType.TrustChanged);
assert.strictEqual(actualChanged.changeType, NotebookChangeType.TrustChanged);
});
test('Should close active session when closed', async function () {
@@ -656,7 +656,7 @@ suite('notebook model', function (): void {
// Ensure client session is cleaned up
assert(isUndefinedOrNull(model.clientSession), 'clientSession is not cleaned up properly');
// Ensure session is no longer ready
assert.equal(model.isSessionReady, false, 'session is incorrectly showing as ready');
assert.strictEqual(model.isSessionReady, false, 'session is incorrectly showing as ready');
});
test('Should disconnect when connection profile created by notebook', async function () {
@@ -722,7 +722,7 @@ suite('notebook model', function (): void {
let expectedAlias = ['fakeAlias'];
let kernelAliases = model.kernelAliases;
assert.equal(kernelAliases.length, 1);
assert.strictEqual(kernelAliases.length, 1);
assert(kernelAliases.includes(expectedAlias[0]));
// // After client session is started, ensure context isn't null/undefined
@@ -748,8 +748,8 @@ suite('notebook model', function (): void {
let doChangeKernelStub = sinon.spy(model, 'doChangeKernel' as keyof NotebookModel);
model.changeKernel(notebookKernelAlias);
assert.equal(model.selectedKernelDisplayName, notebookKernelAlias);
assert.equal(model.currentKernelAlias, notebookKernelAlias);
assert.strictEqual(model.selectedKernelDisplayName, notebookKernelAlias);
assert.strictEqual(model.currentKernelAlias, notebookKernelAlias);
sinon.assert.calledWith(doChangeKernelStub, model.kernelAliases[0]);
doChangeKernelStub.restore();
@@ -776,8 +776,8 @@ suite('notebook model', function (): void {
// Change kernel first to alias kernel and then connect to SQL connection
model.changeKernel(notebookKernelAlias);
assert.equal(model.selectedKernelDisplayName, notebookKernelAlias);
assert.equal(model.currentKernelAlias, notebookKernelAlias);
assert.strictEqual(model.selectedKernelDisplayName, notebookKernelAlias);
assert.strictEqual(model.currentKernelAlias, notebookKernelAlias);
sinon.assert.called(doChangeKernelStub);
doChangeKernelStub.restore();
@@ -785,8 +785,8 @@ suite('notebook model', function (): void {
await changeContextWithConnectionProfile(model);
let expectedKernel = 'SQL';
model.changeKernel(expectedKernel);
assert.equal(model.selectedKernelDisplayName, expectedKernel);
assert.equal(model.currentKernelAlias, undefined);
assert.strictEqual(model.selectedKernelDisplayName, expectedKernel);
assert.strictEqual(model.currentKernelAlias, undefined);
sinon.assert.called(doChangeKernelStub);
doChangeKernelStub.restore();
@@ -838,7 +838,7 @@ suite('notebook model', function (): void {
await model.loadContents();
// I expect the saved connection name to be read
assert.equal(model.savedConnectionName, connectionName);
assert.strictEqual(model.savedConnectionName, connectionName);
// When I request a connection
let spy = sinon.stub(model, 'changeContext').returns(Promise.resolve());
@@ -867,21 +867,21 @@ suite('notebook model', function (): void {
await model.loadContents();
// I expect multiConnectionMode to be set to true
assert.equal(model.multiConnectionMode, true, 'multi_connection_mode not read correctly from notebook metadata');
assert.strictEqual(model.multiConnectionMode, true, 'multi_connection_mode not read correctly from notebook metadata');
// When I change multiConnectionMode to false
model.multiConnectionMode = false;
// I expect multi_connection_mode to not be in the notebook metadata
let output: nb.INotebookContents = model.toJSON();
assert.equal(output.metadata['multi_connection_mode'], undefined, 'multi_connection_mode saved in notebook metadata when it should not be');
assert.strictEqual(output.metadata['multi_connection_mode'], undefined, 'multi_connection_mode saved in notebook metadata when it should not be');
// When I change multiConnectionMode to true
model.multiConnectionMode = true;
// I expect multi_connection_mode to be in the notebook metadata
output = model.toJSON();
assert.equal(output.metadata['multi_connection_mode'], true, 'multi_connection_mode not saved correctly to notebook metadata');
assert.strictEqual(output.metadata['multi_connection_mode'], true, 'multi_connection_mode not saved correctly to notebook metadata');
});
test('Should keep kernel alias as language info kernel alias name even if kernel spec is seralized as SQL', async function () {
@@ -900,7 +900,7 @@ suite('notebook model', function (): void {
await model.requestModelLoad();
// Check to see if language info is set to kernel alias
assert.equal(model.languageInfo.name, 'fake', 'Notebook language info is not set properly');
assert.strictEqual(model.languageInfo.name, 'fake', 'Notebook language info is not set properly');
});
async function loadModelAndStartClientSession(notebookContent: nb.INotebookContents): Promise<NotebookModel> {
@@ -926,7 +926,7 @@ suite('notebook model', function (): void {
// Then I expect load to succeed
assert(!isUndefinedOrNull(model.clientSession), 'clientSession should exist after session is started');
assert.deepEqual(actualSession, mockClientSession, 'session returned is not the expected object');
assert.deepStrictEqual(actualSession, mockClientSession, 'session returned is not the expected object');
// but on server load completion I expect error state to be set
// Note: do not expect serverLoad event to throw even if failed

View File

@@ -151,20 +151,20 @@ suite('notebookUtils', function (): void {
assert.strictEqual(result, undefined);
result = extractCellMagicCommandPlusArgs('%%magic command', 'magic');
assert.equal(result.commandId, 'command');
assert.equal(result.args, '');
assert.strictEqual(result.commandId, 'command');
assert.strictEqual(result.args, '');
result = extractCellMagicCommandPlusArgs('%%magic command arg1', 'magic');
assert.equal(result.commandId, 'command');
assert.equal(result.args, 'arg1');
assert.strictEqual(result.commandId, 'command');
assert.strictEqual(result.args, 'arg1');
result = extractCellMagicCommandPlusArgs('%%magic command arg1 arg2', 'magic');
assert.equal(result.commandId, 'command');
assert.equal(result.args, 'arg1 arg2');
assert.strictEqual(result.commandId, 'command');
assert.strictEqual(result.args, 'arg1 arg2');
result = extractCellMagicCommandPlusArgs('%%magic command.id arg1 arg2 arg3', 'magic');
assert.equal(result.commandId, 'command.id');
assert.equal(result.args, 'arg1 arg2 arg3');
assert.strictEqual(result.commandId, 'command.id');
assert.strictEqual(result.args, 'arg1 arg2 arg3');
});
test('asyncForEach Test', async function (): Promise<void> {

View File

@@ -364,7 +364,7 @@ suite('SQL Connection Tree Action tests', () => {
connection,
connectionManagementService.object);
assert.equal(connectionAction.enabled, false, 'delete action should be disabled.');
assert.strictEqual(connectionAction.enabled, false, 'delete action should be disabled.');
});
test('RefreshConnectionAction - refresh should be called if connection status is connect', () => {

View File

@@ -84,8 +84,8 @@ suite('ServerTreeView onAddConnectionProfile handler tests', () => {
test('isObjectExplorerConnectionUri', async () => {
let connectionUriFalse = serverTreeView.isObjectExplorerConnectionUri('123');
assert.equal(false, connectionUriFalse);
assert.equal(true, serverTreeView.isObjectExplorerConnectionUri('connection:123'));
assert.strictEqual(false, connectionUriFalse);
assert.strictEqual(true, serverTreeView.isObjectExplorerConnectionUri('connection:123'));
});
test('setExpandedState', async () => {

View File

@@ -33,15 +33,15 @@ suite('Connection Utilities tests', () => {
let conProfGroupChild = new ConnectionProfileGroup('testGroupChild', conProfGroup, 'testGroupChild', undefined, undefined);
conProfGroup.addGroups([conProfGroupChild]);
conProfGroupChild.addConnections([connection]);
assert.equal(connection, ConnectionUtils.findProfileInGroup(connection, [conProfGroup]));
assert.strictEqual(connection, ConnectionUtils.findProfileInGroup(connection, [conProfGroup]));
});
test('getUriPrefix - test if getUriPrefix finds the correct prefix from fake uri name', () => {
let testUri = 'test://testpath';
assert.equal('test://', ConnectionUtils.getUriPrefix(testUri));
assert.strictEqual('test://', ConnectionUtils.getUriPrefix(testUri));
let badTestUri = '://>test#%</';
assert.equal(ConnectionUtils.uriPrefixes.default, ConnectionUtils.getUriPrefix(badTestUri));
assert.equal('', ConnectionUtils.getUriPrefix(undefined));
assert.strictEqual(ConnectionUtils.uriPrefixes.default, ConnectionUtils.getUriPrefix(badTestUri));
assert.strictEqual('', ConnectionUtils.getUriPrefix(undefined));
});
@@ -61,6 +61,6 @@ suite('Connection Utilities tests', () => {
let testTime = '28:06:42.12';
let testTimeInMS = 101202012;
//should properly return the time in milliseconds.
assert.equal(testTimeInMS, ConnectionUtils.parseTimeString(testTime));
assert.strictEqual(testTimeInMS, ConnectionUtils.parseTimeString(testTime));
});
});

View File

@@ -87,7 +87,7 @@ suite('SQL QueryAction Tests', () => {
// "class should automatically get set to include the base class and the RunQueryAction class
let className = RunQueryAction.EnabledClass;
assert.equal(queryAction.class, className, 'CSS class not properly set');
assert.strictEqual(queryAction.class, className, 'CSS class not properly set');
});
test('getConnectedQueryEditorUri returns connected URI only if connected', () => {
@@ -146,24 +146,24 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// runQuery should not be run
assert.equal(calledRunQueryOnInput, false, 'run should not call runQuery');
assert.strictEqual(calledRunQueryOnInput, false, 'run should not call runQuery');
testQueryInput.verify(x => x.runQuery(undefined), TypeMoq.Times.never());
// and the connection dialog should open with the correct parameter details
assert.equal(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.equal(connectionParams.runQueryOnCompletion, RunQueryOnConnectionMode.executeQuery, 'runQueryOnCompletion should be true`');
assert.equal(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.equal(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
assert.strictEqual(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.strictEqual(connectionParams.runQueryOnCompletion, RunQueryOnConnectionMode.executeQuery, 'runQueryOnCompletion should be true`');
assert.strictEqual(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.strictEqual(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
// If I call run on RunQueryAction when I am connected
isConnected = true;
await queryAction.run();
//runQuery should be run, and the conneciton dialog should not open
assert.equal(calledRunQueryOnInput, true, 'run should call runQuery');
assert.strictEqual(calledRunQueryOnInput, true, 'run should call runQuery');
testQueryInput.verify(x => x.runQuery(undefined), TypeMoq.Times.once());
assert.equal(countCalledShowDialog, 1, 'run should not call showDialog');
assert.strictEqual(countCalledShowDialog, 1, 'run should not call showDialog');
});
test('Queries are only run if the QueryEditor selection is not empty', async () => {
@@ -205,14 +205,14 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
//runQuery should be run
assert.equal(countCalledRunQuery, 1, 'runQuery should be called');
assert.strictEqual(countCalledRunQuery, 1, 'runQuery should be called');
// If I call run on RunQueryAction when I have an empty selection
isSelectionEmpty = true;
await queryAction.run();
//runQuery should not be run again
assert.equal(countCalledRunQuery, 1, 'runQuery should not be called again');
assert.strictEqual(countCalledRunQuery, 1, 'runQuery should not be called again');
});
test('ISelectionData is properly passed when queries are run', async () => {
@@ -276,10 +276,10 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// The conneciton dialog should open with an undefined seleciton
assert.equal(countCalledShowDialog, 1, 'run should call showDialog');
assert.equal(countCalledRunQuery, 0, 'run should not call runQuery');
assert.equal(showDialogConnectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.equal(showDialogConnectionParams.queryRange, undefined, 'querySelection should be undefined');
assert.strictEqual(countCalledShowDialog, 1, 'run should call showDialog');
assert.strictEqual(countCalledRunQuery, 0, 'run should not call runQuery');
assert.strictEqual(showDialogConnectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.strictEqual(showDialogConnectionParams.queryRange, undefined, 'querySelection should be undefined');
////// If I call run on RunQueryAction while disconnected and with a defined selection
isConnected = false;
@@ -287,14 +287,14 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// The conneciton dialog should open with the correct seleciton
assert.equal(countCalledShowDialog, 2, 'run should call showDialog again');
assert.equal(countCalledRunQuery, 0, 'run should not call runQuery');
assert.equal(showDialogConnectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.notEqual(showDialogConnectionParams.queryRange, undefined, 'There should not be an undefined selection in runQuery');
assert.equal(showDialogConnectionParams.queryRange.startLineNumber, selectionToReturnInGetSelection.startLineNumber, 'startLine should match');
assert.equal(showDialogConnectionParams.queryRange.startColumn, selectionToReturnInGetSelection.startColumn, 'startColumn should match');
assert.equal(showDialogConnectionParams.queryRange.endLineNumber, selectionToReturnInGetSelection.endLineNumber, 'endLine should match');
assert.equal(showDialogConnectionParams.queryRange.endColumn, selectionToReturnInGetSelection.endColumn, 'endColumn should match');
assert.strictEqual(countCalledShowDialog, 2, 'run should call showDialog again');
assert.strictEqual(countCalledRunQuery, 0, 'run should not call runQuery');
assert.strictEqual(showDialogConnectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.notStrictEqual(showDialogConnectionParams.queryRange, undefined, 'There should not be an undefined selection in runQuery');
assert.strictEqual(showDialogConnectionParams.queryRange.startLineNumber, selectionToReturnInGetSelection.startLineNumber, 'startLine should match');
assert.strictEqual(showDialogConnectionParams.queryRange.startColumn, selectionToReturnInGetSelection.startColumn, 'startColumn should match');
assert.strictEqual(showDialogConnectionParams.queryRange.endLineNumber, selectionToReturnInGetSelection.endLineNumber, 'endLine should match');
assert.strictEqual(showDialogConnectionParams.queryRange.endColumn, selectionToReturnInGetSelection.endColumn, 'endColumn should match');
////// If I call run on RunQueryAction while connected and with an undefined selection
isConnected = true;
@@ -302,9 +302,9 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// The query should run with an undefined selection
assert.equal(countCalledShowDialog, 2, 'run should not call showDialog');
assert.equal(countCalledRunQuery, 1, 'run should call runQuery');
assert.equal(runQuerySelection, undefined, 'There should be an undefined selection in runQuery');
assert.strictEqual(countCalledShowDialog, 2, 'run should not call showDialog');
assert.strictEqual(countCalledRunQuery, 1, 'run should call runQuery');
assert.strictEqual(runQuerySelection, undefined, 'There should be an undefined selection in runQuery');
////// If I call run on RunQueryAction while connected and with a defined selection
isConnected = true;
@@ -312,13 +312,13 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// The query should run with the given seleciton
assert.equal(countCalledShowDialog, 2, 'run should not call showDialog');
assert.equal(countCalledRunQuery, 2, 'run should call runQuery again');
assert.notEqual(runQuerySelection, undefined, 'There should not be an undefined selection in runQuery');
assert.equal(runQuerySelection.startLineNumber, selectionToReturnInGetSelection.startLineNumber, 'startLine should match');
assert.equal(runQuerySelection.startColumn, selectionToReturnInGetSelection.startColumn, 'startColumn should match');
assert.equal(runQuerySelection.endLineNumber, selectionToReturnInGetSelection.endLineNumber, 'endLine should match');
assert.equal(runQuerySelection.endColumn, selectionToReturnInGetSelection.endColumn, 'endColumn should match');
assert.strictEqual(countCalledShowDialog, 2, 'run should not call showDialog');
assert.strictEqual(countCalledRunQuery, 2, 'run should call runQuery again');
assert.notStrictEqual(runQuerySelection, undefined, 'There should not be an undefined selection in runQuery');
assert.strictEqual(runQuerySelection.startLineNumber, selectionToReturnInGetSelection.startLineNumber, 'startLine should match');
assert.strictEqual(runQuerySelection.startColumn, selectionToReturnInGetSelection.startColumn, 'startColumn should match');
assert.strictEqual(runQuerySelection.endLineNumber, selectionToReturnInGetSelection.endLineNumber, 'endLine should match');
assert.strictEqual(runQuerySelection.endColumn, selectionToReturnInGetSelection.endColumn, 'endColumn should match');
});
test('CancelQueryAction calls cancelQuery() only if URI is connected', async () => {
@@ -341,14 +341,14 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// cancelQuery should not be run
assert.equal(calledCancelQuery, false, 'run should not call cancelQuery');
assert.strictEqual(calledCancelQuery, false, 'run should not call cancelQuery');
// If I call run on CancelQueryAction when I am connected
isConnected = true;
await queryAction.run();
// cancelQuery should be run
assert.equal(calledCancelQuery, true, 'run should call cancelQuery');
assert.strictEqual(calledCancelQuery, true, 'run should call cancelQuery');
});
// We want to call disconnectEditor regardless of connection to be able to cancel in-progress connections
@@ -369,14 +369,14 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// disconnectEditor should be run
assert.equal(countCalledDisconnectEditor, 1, 'disconnectEditor should be called when URI is not connected');
assert.strictEqual(countCalledDisconnectEditor, 1, 'disconnectEditor should be called when URI is not connected');
// If I call run on DisconnectDatabaseAction when I am connected
isConnected = true;
await queryAction.run();
// disconnectEditor should be run again
assert.equal(countCalledDisconnectEditor, 2, 'disconnectEditor should be called when URI is connected');
assert.strictEqual(countCalledDisconnectEditor, 2, 'disconnectEditor should be called when URI is connected');
});
test('ConnectDatabaseAction opens dialog regardless of URI connection state', async () => {
@@ -400,22 +400,22 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// The conneciton dialog should open with the correct parameter details
assert.equal(countCalledShowDialog, 1, 'run should call showDialog');
assert.equal(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.equal(connectionParams.runQueryOnCompletion, false, 'runQueryOnCompletion should be false`');
assert.equal(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.equal(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
assert.strictEqual(countCalledShowDialog, 1, 'run should call showDialog');
assert.strictEqual(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.strictEqual(connectionParams.runQueryOnCompletion, 0, 'runQueryOnCompletion should be false`');
assert.strictEqual(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.strictEqual(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
// If I call run on ConnectDatabaseAction when I am connected
isConnected = true;
await queryAction.run();
// The conneciton dialog should open again with the correct parameter details
assert.equal(countCalledShowDialog, 2, 'run should call showDialog');
assert.equal(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.equal(connectionParams.runQueryOnCompletion, false, 'runQueryOnCompletion should be false`');
assert.equal(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.equal(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
assert.strictEqual(countCalledShowDialog, 2, 'run should call showDialog');
assert.strictEqual(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.strictEqual(connectionParams.runQueryOnCompletion, 0, 'runQueryOnCompletion should be false`');
assert.strictEqual(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.strictEqual(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
});
test('ChangeConnectionAction connects regardless of URI being connected', async () => {
@@ -439,21 +439,21 @@ suite('SQL QueryAction Tests', () => {
await queryAction.run();
// The connection dialog should open with the params set as below
assert.equal(calledShowDialog, 1, 'showDialog should be called when URI is connected');
assert.equal(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.equal(connectionParams.runQueryOnCompletion, false, 'runQueryOnCompletion should be false`');
assert.equal(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.equal(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
assert.strictEqual(calledShowDialog, 1, 'showDialog should be called when URI is connected');
assert.strictEqual(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.strictEqual(connectionParams.runQueryOnCompletion, 0, 'runQueryOnCompletion should be false`');
assert.strictEqual(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.strictEqual(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
// Then if I call run on ChangeConnectionAction when I am connected
isConnected = true;
await queryAction.run();
// The conneciton dialog should open with the params set as below
assert.equal(calledShowDialog, 2, 'showDialog should be called when URI is connected');
assert.equal(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.equal(connectionParams.runQueryOnCompletion, false, 'runQueryOnCompletion should be false`');
assert.equal(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.equal(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
assert.strictEqual(calledShowDialog, 2, 'showDialog should be called when URI is connected');
assert.strictEqual(connectionParams.connectionType, ConnectionType.editor, 'connectionType should be queryEditor');
assert.strictEqual(connectionParams.runQueryOnCompletion, 0, 'runQueryOnCompletion should be false`');
assert.strictEqual(connectionParams.input.uri, testUri, 'URI should be set to the test URI');
assert.strictEqual(connectionParams.input, editor.object.input, 'Editor should be set to the mock editor');
});
test('ListDatabaseItem shows items as expected', () => {
@@ -474,22 +474,22 @@ suite('SQL QueryAction Tests', () => {
// If I query without having initialized anything, state should be clear
listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, undefined);
assert.equal(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
assert.strictEqual(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.strictEqual(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
// When I connect, database name should be returned in the dropdown and this should be enabled
isConnected = true;
databaseName = 'master';
listItem.onConnected();
assert.equal(listItem.isEnabled(), true, 'expect dropdown enabled when connected');
assert.equal(listItem.currentDatabaseName, 'master', 'expect dropdown to have current DB name when connected');
assert.strictEqual(listItem.isEnabled(), true, 'expect dropdown enabled when connected');
assert.strictEqual(listItem.currentDatabaseName, 'master', 'expect dropdown to have current DB name when connected');
// When I disconnect, state should return to default
isConnected = false;
databaseName = undefined;
listItem.onDisconnect();
assert.equal(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
assert.strictEqual(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected');
assert.strictEqual(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected');
});
test('ListDatabaseItem - null event params', () => {
@@ -513,7 +513,7 @@ suite('SQL QueryAction Tests', () => {
dbChangedEmitter.fire(eventParams);
// Then: The selected database should not have changed
assert.equal(listItem.currentDatabaseName, databaseName);
assert.strictEqual(listItem.currentDatabaseName, databaseName);
});
test('ListDatabaseItem - wrong uri', () => {
@@ -542,7 +542,7 @@ suite('SQL QueryAction Tests', () => {
dbChangedEmitter.fire(eventParams);
// Then: The selected database should not have changed
assert.equal(listItem.currentDatabaseName, databaseName);
assert.strictEqual(listItem.currentDatabaseName, databaseName);
});
test('ListDatabaseItem - updates when connected and uri matches', () => {
@@ -567,7 +567,7 @@ suite('SQL QueryAction Tests', () => {
// Then:
// ... The connection should have changed to the provided database
assert.equal(listItem.currentDatabaseName, eventParams.connectionProfile.databaseName);
assert.strictEqual(listItem.currentDatabaseName, eventParams.connectionProfile.databaseName);
});
test('runCurrent - opens connection dialog when there are no active connections', async () => {
@@ -599,7 +599,7 @@ suite('SQL QueryAction Tests', () => {
await queryAction.runCurrent();
//connection dialog should open and runQueryStatement should not be called
assert.equal(calledRunQueryStatementOnInput, false, 'runCurrent should not call runQueryStatement');
assert.strictEqual(calledRunQueryStatementOnInput, false, 'runCurrent should not call runQueryStatement');
testQueryInput.verify(x => x.runQueryStatement(TypeMoq.It.isAny()), TypeMoq.Times.never());
connectionManagementService.verify(x => x.showConnectionDialog(TypeMoq.It.isAny()), TypeMoq.Times.once());
@@ -609,7 +609,7 @@ suite('SQL QueryAction Tests', () => {
await queryAction.runCurrent();
//connection dialog should not open and runQueryStatement should be called
assert.equal(calledRunQueryStatementOnInput, true, 'runCurrent should call runQueryStatement');
assert.strictEqual(calledRunQueryStatementOnInput, true, 'runCurrent should call runQueryStatement');
testQueryInput.verify(x => x.runQueryStatement(TypeMoq.It.isAny()), TypeMoq.Times.once());
//show Dialog is not called
connectionManagementService.verify(x => x.showConnectionDialog(TypeMoq.It.isAny()), TypeMoq.Times.once());
@@ -623,7 +623,7 @@ suite('SQL QueryAction Tests', () => {
queryEditor.setup(x => x.isSelectionEmpty()).returns(() => true);
//connection dialog should not open and runQueryStatement should not be called
assert.equal(calledRunQueryStatementOnInput, false, 'runCurrent should not call runQueryStatemet');
assert.strictEqual(calledRunQueryStatementOnInput, false, 'runCurrent should not call runQueryStatemet');
connectionManagementService.verify(x => x.showConnectionDialog(TypeMoq.It.isAny()), TypeMoq.Times.once());
});
@@ -659,8 +659,8 @@ suite('SQL QueryAction Tests', () => {
calledRunQueryStatementOnInput = false;
await queryAction.runCurrent();
assert.equal(calledRunQueryStatementOnInput, true, 'runCurrent should call runQueryStatement');
assert.equal(calledRunQueryOnInput, false, 'run should not call runQuery');
assert.strictEqual(calledRunQueryStatementOnInput, true, 'runCurrent should call runQueryStatement');
assert.strictEqual(calledRunQueryOnInput, false, 'run should not call runQuery');
// checking if runQuery statement is called with predefinedCursorSelection only
testQueryInput.verify(x => x.runQueryStatement(TypeMoq.It.isValue(predefinedCursorSelection)), TypeMoq.Times.once());
@@ -677,8 +677,8 @@ suite('SQL QueryAction Tests', () => {
calledRunQueryStatementOnInput = false;
await queryAction.runCurrent();
assert.equal(calledRunQueryStatementOnInput, false, 'runCurrent should not call runQueryStatement');
assert.equal(calledRunQueryOnInput, true, 'run should call runQuery');
assert.strictEqual(calledRunQueryStatementOnInput, false, 'runCurrent should not call runQueryStatement');
assert.strictEqual(calledRunQueryOnInput, true, 'run should call runQuery');
// checking if runQuery is called with predefinedRangeSelection only
testQueryInput.verify(x => x.runQuery(TypeMoq.It.isValue(predefinedRangeSelection)), TypeMoq.Times.once());

View File

@@ -109,17 +109,17 @@ suite('SQL QueryEditor Tests', () => {
test('setInput creates SQL components', (done) => {
let assertInput = function () {
// The taskbar SQL, and parent should be created
assert.equal(!!editor.taskbar, true);
assert.equal(!!editor.taskbarContainer, true);
assert.equal(!!editor.getContainer(), true);
assert.equal(!!editor.sqlEditor, true);
assert.equal(!!editor.sqlEditorContainer, true);
assert.strictEqual(!!editor.taskbar, true);
assert.strictEqual(!!editor.taskbarContainer, true);
assert.strictEqual(!!editor.getContainer(), true);
assert.strictEqual(!!editor.sqlEditor, true);
assert.strictEqual(!!editor.sqlEditorContainer, true);
// But the results componenets should not
assert.equal(!!editor.resultsEditor, false);
assert.equal(!!editor.resultsEditorContainer, false);
assert.equal(!!editor.sash, false);
assert.equal(!!editor._isResultsEditorVisible(), false);
assert.strictEqual(!!editor.resultsEditor, false);
assert.strictEqual(!!editor.resultsEditorContainer, false);
assert.strictEqual(!!editor.sash, false);
assert.strictEqual(!!editor._isResultsEditorVisible(), false);
};
// If I call create a QueryEditor
@@ -142,15 +142,15 @@ suite('SQL QueryEditor Tests', () => {
// Make the asserts thenable
let assertInput = function () {
assert.equal(!!editor.taskbar, true);
assert.equal(!!editor.taskbarContainer, true);
assert.equal(!!editor.getContainer(), true);
assert.equal(!!editor.sqlEditor, true);
assert.equal(!!editor.sqlEditorContainer, true);
assert.equal(!!editor.resultsEditor, true);
assert.equal(!!editor.resultsEditorContainer, true);
assert.equal(!!editor.sash, true);
assert.equal(!!editor._isResultsEditorVisible(), true);
assert.strictEqual(!!editor.taskbar, true);
assert.strictEqual(!!editor.taskbarContainer, true);
assert.strictEqual(!!editor.getContainer(), true);
assert.strictEqual(!!editor.sqlEditor, true);
assert.strictEqual(!!editor.sqlEditorContainer, true);
assert.strictEqual(!!editor.resultsEditor, true);
assert.strictEqual(!!editor.resultsEditorContainer, true);
assert.strictEqual(!!editor.sash, true);
assert.strictEqual(!!editor._isResultsEditorVisible(), true);
editorGroupService.verify(x => x.pinEditor(undefined, TypeMoq.It.isAny()), TypeMoq.Times.once());
};
@@ -191,7 +191,7 @@ suite('SQL QueryEditor Tests', () => {
};
let assertFirstInputIsSet = function () {
assert.notEqual(firstContainer.parentElement, undefined);
assert.notStrictEqual(firstContainer.parentElement, undefined);
};
let setSecondInput = function () {
@@ -205,16 +205,16 @@ suite('SQL QueryEditor Tests', () => {
secondContainer.id = secondContainerId;
// The inputs should not match
assert.notEqual(firstInput.getName(), secondInput.getName());
assert.notEqual(firstContainer.id, secondContainer.id);
assert.equal(firstContainer.id, firstContainerId);
assert.notStrictEqual(firstInput.getName(), secondInput.getName());
assert.notStrictEqual(firstContainer.id, secondContainer.id);
assert.strictEqual(firstContainer.id, firstContainerId);
// The first input should be disposed
assert.notEqual(firstContainer.parentElement, secondContainer.parentElement);
assert.equal(firstContainer.parentElement, undefined);
assert.notStrictEqual(firstContainer.parentElement, secondContainer.parentElement);
assert.strictEqual(firstContainer.parentElement, undefined);
// The second input should be added into the DOM
assert.notEqual(secondContainer.parentElement, undefined);
assert.notStrictEqual(secondContainer.parentElement, undefined);
};
let setFirstInputAgain = function () {
@@ -227,16 +227,16 @@ suite('SQL QueryEditor Tests', () => {
firstContainer = editor.sqlEditorContainer;
// The inputs should not match
assert.notEqual(firstInput.getName(), secondInput.getName());
assert.notEqual(firstContainer.id, secondContainer.id);
assert.equal(secondContainer.id, secondContainerId);
assert.notStrictEqual(firstInput.getName(), secondInput.getName());
assert.notStrictEqual(firstContainer.id, secondContainer.id);
assert.strictEqual(secondContainer.id, secondContainerId);
// The first input should be added into the DOM
assert.equal(secondContainer.parentElement, undefined);
assert.strictEqual(secondContainer.parentElement, undefined);
// The second input should be disposed
assert.notEqual(firstContainer.parentElement, secondContainer.parentElement);
assert.notEqual(firstContainer.parentElement, undefined);
assert.notStrictEqual(firstContainer.parentElement, secondContainer.parentElement);
assert.notStrictEqual(firstContainer.parentElement, undefined);
};
// If I create a QueryEditor
@@ -322,18 +322,18 @@ suite('SQL QueryEditor Tests', () => {
queryModelService.setup(x => x.isRunningQuery(TypeMoq.It.isAny())).returns(() => false);
// If I use the created QueryEditor with no changes since creation
// Buttons should be set as if disconnected
assert.equal(queryInput.state.connected, false, 'query state should be not connected');
assert.equal(queryInput.state.executing, false, 'query state should be not executing');
assert.equal(queryInput.state.connecting, false, 'query state should be not connecting');
assert.strictEqual(queryInput.state.connected, false, 'query state should be not connected');
assert.strictEqual(queryInput.state.executing, false, 'query state should be not executing');
assert.strictEqual(queryInput.state.connecting, false, 'query state should be not connecting');
});
test('Taskbar buttons are set correctly upon connect', () => {
let params: INewConnectionParams = { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.none };
queryModelService.setup(x => x.isRunningQuery(TypeMoq.It.isAny())).returns(() => false);
queryInput.onConnectSuccess(params);
assert.equal(queryInput.state.connected, true, 'query state should be not connected');
assert.equal(queryInput.state.executing, false, 'query state should be not executing');
assert.equal(queryInput.state.connecting, false, 'query state should be not connecting');
assert.strictEqual(queryInput.state.connected, true, 'query state should be not connected');
assert.strictEqual(queryInput.state.executing, false, 'query state should be not executing');
assert.strictEqual(queryInput.state.connecting, false, 'query state should be not connecting');
});
test('Test that we attempt to dispose query when the queryInput is disposed', () => {
let queryResultsInput = new QueryResultsInput('testUri');