mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 01:25:37 -05:00
@@ -76,6 +76,7 @@
|
||||
"devDependencies": {
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
"mocha-multi-reporters": "^1.1.7",
|
||||
"should": "^13.2.3",
|
||||
"vscode": "^1.1.36"
|
||||
},
|
||||
"__metadata": {
|
||||
|
||||
@@ -583,6 +583,50 @@ semver@^5.4.1:
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
|
||||
integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==
|
||||
|
||||
should-equal@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3"
|
||||
integrity sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==
|
||||
dependencies:
|
||||
should-type "^1.4.0"
|
||||
|
||||
should-format@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
|
||||
integrity sha1-m/yPdPo5IFxT04w01xcwPidxJPE=
|
||||
dependencies:
|
||||
should-type "^1.3.0"
|
||||
should-type-adaptors "^1.0.1"
|
||||
|
||||
should-type-adaptors@^1.0.1:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a"
|
||||
integrity sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==
|
||||
dependencies:
|
||||
should-type "^1.3.0"
|
||||
should-util "^1.0.0"
|
||||
|
||||
should-type@^1.3.0, should-type@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
|
||||
integrity sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=
|
||||
|
||||
should-util@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.1.tgz#fb0d71338f532a3a149213639e2d32cbea8bcb28"
|
||||
integrity sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==
|
||||
|
||||
should@^13.2.3:
|
||||
version "13.2.3"
|
||||
resolved "https://registry.yarnpkg.com/should/-/should-13.2.3.tgz#96d8e5acf3e97b49d89b51feaa5ae8d07ef58f10"
|
||||
integrity sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==
|
||||
dependencies:
|
||||
should-equal "^2.0.0"
|
||||
should-format "^3.0.3"
|
||||
should-type "^1.4.0"
|
||||
should-type-adaptors "^1.0.1"
|
||||
should-util "^1.0.0"
|
||||
|
||||
source-map-support@^0.5.0:
|
||||
version "0.5.16"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042"
|
||||
|
||||
@@ -466,6 +466,7 @@
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-junit-reporter": "^1.17.0",
|
||||
"mocha-multi-reporters": "^1.1.7",
|
||||
"should": "^13.2.3",
|
||||
"typemoq": "^2.1.0",
|
||||
"vscode": "1.1.5"
|
||||
},
|
||||
|
||||
@@ -2213,6 +2213,50 @@ semver@^5.3.0, semver@^5.5.0:
|
||||
resolved "https://registry.yarnpkg.com/semver/-/semver-5.6.0.tgz#7e74256fbaa49c75aa7c7a205cc22799cac80004"
|
||||
integrity sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==
|
||||
|
||||
should-equal@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3"
|
||||
integrity sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==
|
||||
dependencies:
|
||||
should-type "^1.4.0"
|
||||
|
||||
should-format@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
|
||||
integrity sha1-m/yPdPo5IFxT04w01xcwPidxJPE=
|
||||
dependencies:
|
||||
should-type "^1.3.0"
|
||||
should-type-adaptors "^1.0.1"
|
||||
|
||||
should-type-adaptors@^1.0.1:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a"
|
||||
integrity sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==
|
||||
dependencies:
|
||||
should-type "^1.3.0"
|
||||
should-util "^1.0.0"
|
||||
|
||||
should-type@^1.3.0, should-type@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
|
||||
integrity sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=
|
||||
|
||||
should-util@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.1.tgz#fb0d71338f532a3a149213639e2d32cbea8bcb28"
|
||||
integrity sha512-oXF8tfxx5cDk8r2kYqlkUJzZpDBqVY/II2WhvU0n9Y3XYvAYRmeaf1PvvIvTgPnv4KJ+ES5M0PyDq5Jp+Ygy2g==
|
||||
|
||||
should@^13.2.3:
|
||||
version "13.2.3"
|
||||
resolved "https://registry.yarnpkg.com/should/-/should-13.2.3.tgz#96d8e5acf3e97b49d89b51feaa5ae8d07ef58f10"
|
||||
integrity sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==
|
||||
dependencies:
|
||||
should-equal "^2.0.0"
|
||||
should-format "^3.0.3"
|
||||
should-type "^1.4.0"
|
||||
should-type-adaptors "^1.0.1"
|
||||
should-util "^1.0.0"
|
||||
|
||||
source-map-support@^0.4.11:
|
||||
version "0.4.18"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.4.18.tgz#0286a6de8be42641338594e97ccea75f0a2c585f"
|
||||
|
||||
@@ -94,7 +94,6 @@
|
||||
"@types/plotly.js": "^1.44.9",
|
||||
"@types/sanitize-html": "^1.18.2",
|
||||
"@types/semver": "^5.5.0",
|
||||
"@types/should": "^13.0.0",
|
||||
"@types/sinon": "^1.16.36",
|
||||
"@types/webpack": "^4.4.10",
|
||||
"@types/winreg": "^1.2.30",
|
||||
@@ -154,7 +153,6 @@
|
||||
"queue": "3.0.6",
|
||||
"rcedit": "^1.1.0",
|
||||
"rimraf": "^2.2.8",
|
||||
"should": "^13.2.3",
|
||||
"sinon": "^1.17.2",
|
||||
"source-map": "^0.4.4",
|
||||
"temp-write": "^3.4.0",
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { JobsRefreshAction, NewJobAction, EditJobAction, RunJobAction, StopJobAction, DeleteJobAction, NewStepAction, DeleteStepAction, NewAlertAction, EditAlertAction, DeleteAlertAction, NewOperatorAction, EditOperatorAction, DeleteOperatorAction, NewProxyAction, EditProxyAction, DeleteProxyAction } from 'sql/platform/jobManagement/browser/jobActions';
|
||||
import { JobManagementService } from 'sql/platform/jobManagement/common/jobManagementService';
|
||||
|
||||
@@ -80,8 +81,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);
|
||||
should(mockRefreshAction.object.id).equal(JobsRefreshAction.ID);
|
||||
should(mockRefreshAction.object.label).equal(JobsRefreshAction.LABEL);
|
||||
assert.equal(mockRefreshAction.object.id, JobsRefreshAction.ID);
|
||||
assert.equal(mockRefreshAction.object.label, JobsRefreshAction.LABEL);
|
||||
|
||||
// Job Refresh Action from Jobs View should refresh the component
|
||||
mockRefreshAction.object.run(null);
|
||||
@@ -94,8 +95,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);
|
||||
should(mockNewJobAction.object.id).equal(NewJobAction.ID);
|
||||
should(mockNewJobAction.object.label).equal(NewJobAction.LABEL);
|
||||
assert.equal(mockNewJobAction.object.id, NewJobAction.ID);
|
||||
assert.equal(mockNewJobAction.object.label, NewJobAction.LABEL);
|
||||
|
||||
// New Job Action from Jobs View should open a dialog
|
||||
mockNewJobAction.object.run(null);
|
||||
@@ -112,12 +113,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockEditJobAction.setup(s => s.id).returns(() => EditJobAction.ID);
|
||||
mockEditJobAction.setup(s => s.label).returns(() => EditJobAction.LABEL);
|
||||
should(mockEditJobAction.object.id).equal(EditJobAction.ID);
|
||||
should(mockEditJobAction.object.label).equal(EditJobAction.LABEL);
|
||||
assert.equal(mockEditJobAction.object.id, EditJobAction.ID);
|
||||
assert.equal(mockEditJobAction.object.label, EditJobAction.LABEL);
|
||||
|
||||
// Edit Job Action from Jobs View should open a dialog
|
||||
mockEditJobAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -130,8 +131,8 @@ suite('Job Management Actions', () => {
|
||||
|
||||
mockRunJobAction.setup(s => s.id).returns(() => RunJobAction.ID);
|
||||
mockRunJobAction.setup(s => s.label).returns(() => RunJobAction.LABEL);
|
||||
should(mockRunJobAction.object.id).equal(RunJobAction.ID);
|
||||
should(mockRunJobAction.object.label).equal(RunJobAction.LABEL);
|
||||
assert.equal(mockRunJobAction.object.id, RunJobAction.ID);
|
||||
assert.equal(mockRunJobAction.object.label, RunJobAction.LABEL);
|
||||
|
||||
// Run Job Action should make the Job Management service call job action
|
||||
mockRunJobAction.object.run(null);
|
||||
@@ -148,8 +149,8 @@ suite('Job Management Actions', () => {
|
||||
|
||||
mockStopJobAction.setup(s => s.id).returns(() => RunJobAction.ID);
|
||||
mockStopJobAction.setup(s => s.label).returns(() => RunJobAction.LABEL);
|
||||
should(mockStopJobAction.object.id).equal(RunJobAction.ID);
|
||||
should(mockStopJobAction.object.label).equal(RunJobAction.LABEL);
|
||||
assert.equal(mockStopJobAction.object.id, RunJobAction.ID);
|
||||
assert.equal(mockStopJobAction.object.label, RunJobAction.LABEL);
|
||||
|
||||
// Run Job Action should make the Job Management service call job action
|
||||
mockStopJobAction.object.run(null);
|
||||
@@ -166,8 +167,8 @@ suite('Job Management Actions', () => {
|
||||
|
||||
mockDeleteJobAction.setup(s => s.id).returns(() => DeleteJobAction.ID);
|
||||
mockDeleteJobAction.setup(s => s.label).returns(() => DeleteJobAction.LABEL);
|
||||
should(mockDeleteJobAction.object.id).equal(DeleteJobAction.ID);
|
||||
should(mockDeleteJobAction.object.label).equal(DeleteJobAction.LABEL);
|
||||
assert.equal(mockDeleteJobAction.object.id, DeleteJobAction.ID);
|
||||
assert.equal(mockDeleteJobAction.object.label, DeleteJobAction.LABEL);
|
||||
|
||||
// Run Job Action should make the Job Management service call job action
|
||||
mockDeleteJobAction.object.run(null);
|
||||
@@ -185,12 +186,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockNewStepAction.setup(s => s.id).returns(() => NewJobAction.ID);
|
||||
mockNewStepAction.setup(s => s.label).returns(() => NewJobAction.LABEL);
|
||||
should(mockNewStepAction.object.id).equal(NewJobAction.ID);
|
||||
should(mockNewStepAction.object.label).equal(NewJobAction.LABEL);
|
||||
assert.equal(mockNewStepAction.object.id, NewJobAction.ID);
|
||||
assert.equal(mockNewStepAction.object.label, NewJobAction.LABEL);
|
||||
|
||||
// New Step Action should called command service
|
||||
mockNewStepAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -204,12 +205,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockDeleteStepAction.setup(s => s.id).returns(() => DeleteStepAction.ID);
|
||||
mockDeleteStepAction.setup(s => s.label).returns(() => DeleteStepAction.LABEL);
|
||||
should(mockDeleteStepAction.object.id).equal(DeleteStepAction.ID);
|
||||
should(mockDeleteStepAction.object.label).equal(DeleteStepAction.LABEL);
|
||||
assert.equal(mockDeleteStepAction.object.id, DeleteStepAction.ID);
|
||||
assert.equal(mockDeleteStepAction.object.label, DeleteStepAction.LABEL);
|
||||
|
||||
// Delete Step Action should called command service
|
||||
mockDeleteStepAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
mockJobManagementService.verify(s => s.deleteJobStep(null, null), TypeMoq.Times.once());
|
||||
done();
|
||||
});
|
||||
@@ -220,8 +221,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);
|
||||
should(mockNewAlertAction.object.id).equal(NewJobAction.ID);
|
||||
should(mockNewAlertAction.object.label).equal(NewJobAction.LABEL);
|
||||
assert.equal(mockNewAlertAction.object.id, NewJobAction.ID);
|
||||
assert.equal(mockNewAlertAction.object.label, NewJobAction.LABEL);
|
||||
|
||||
// New Alert Action from Alerts View should open a dialog
|
||||
mockNewAlertAction.object.run(null);
|
||||
@@ -238,12 +239,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockEditAlertAction.setup(s => s.id).returns(() => EditAlertAction.ID);
|
||||
mockEditAlertAction.setup(s => s.label).returns(() => EditAlertAction.LABEL);
|
||||
should(mockEditAlertAction.object.id).equal(EditAlertAction.ID);
|
||||
should(mockEditAlertAction.object.label).equal(EditAlertAction.LABEL);
|
||||
assert.equal(mockEditAlertAction.object.id, EditAlertAction.ID);
|
||||
assert.equal(mockEditAlertAction.object.label, EditAlertAction.LABEL);
|
||||
|
||||
// Edit Alert Action from Jobs View should open a dialog
|
||||
mockEditAlertAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -257,12 +258,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockDeleteAlertAction.setup(s => s.id).returns(() => DeleteAlertAction.ID);
|
||||
mockDeleteAlertAction.setup(s => s.label).returns(() => DeleteAlertAction.LABEL);
|
||||
should(mockDeleteAlertAction.object.id).equal(DeleteAlertAction.ID);
|
||||
should(mockDeleteAlertAction.object.label).equal(DeleteAlertAction.LABEL);
|
||||
assert.equal(mockDeleteAlertAction.object.id, DeleteAlertAction.ID);
|
||||
assert.equal(mockDeleteAlertAction.object.label, DeleteAlertAction.LABEL);
|
||||
|
||||
// Delete Alert Action should call job management service
|
||||
mockDeleteAlertAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
mockJobManagementService.verify(s => s.deleteAlert(null, null), TypeMoq.Times.once());
|
||||
done();
|
||||
});
|
||||
@@ -273,8 +274,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);
|
||||
should(mockNewOperatorAction.object.id).equal(NewOperatorAction.ID);
|
||||
should(mockNewOperatorAction.object.label).equal(NewOperatorAction.LABEL);
|
||||
assert.equal(mockNewOperatorAction.object.id, NewOperatorAction.ID);
|
||||
assert.equal(mockNewOperatorAction.object.label, NewOperatorAction.LABEL);
|
||||
|
||||
// New Operator Action from Operators View should open a dialog
|
||||
mockNewOperatorAction.object.run(null);
|
||||
@@ -291,12 +292,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockEditOperatorAction.setup(s => s.id).returns(() => EditOperatorAction.ID);
|
||||
mockEditOperatorAction.setup(s => s.label).returns(() => EditOperatorAction.LABEL);
|
||||
should(mockEditOperatorAction.object.id).equal(EditOperatorAction.ID);
|
||||
should(mockEditOperatorAction.object.label).equal(EditOperatorAction.LABEL);
|
||||
assert.equal(mockEditOperatorAction.object.id, EditOperatorAction.ID);
|
||||
assert.equal(mockEditOperatorAction.object.label, EditOperatorAction.LABEL);
|
||||
|
||||
// Edit Operator Action from Jobs View should open a dialog
|
||||
mockEditOperatorAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -310,12 +311,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockDeleteOperatorAction.setup(s => s.id).returns(() => DeleteOperatorAction.ID);
|
||||
mockDeleteOperatorAction.setup(s => s.label).returns(() => DeleteOperatorAction.LABEL);
|
||||
should(mockDeleteOperatorAction.object.id).equal(DeleteOperatorAction.ID);
|
||||
should(mockDeleteOperatorAction.object.label).equal(DeleteOperatorAction.LABEL);
|
||||
assert.equal(mockDeleteOperatorAction.object.id, DeleteOperatorAction.ID);
|
||||
assert.equal(mockDeleteOperatorAction.object.label, DeleteOperatorAction.LABEL);
|
||||
|
||||
// Delete Operator Action should call job management service
|
||||
mockDeleteOperatorAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
mockJobManagementService.verify(s => s.deleteOperator(null, null), TypeMoq.Times.once());
|
||||
done();
|
||||
});
|
||||
@@ -326,8 +327,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);
|
||||
should(mockNewProxyAction.object.id).equal(NewProxyAction.ID);
|
||||
should(mockNewProxyAction.object.label).equal(NewProxyAction.LABEL);
|
||||
assert.equal(mockNewProxyAction.object.id, NewProxyAction.ID);
|
||||
assert.equal(mockNewProxyAction.object.label, NewProxyAction.LABEL);
|
||||
|
||||
// New Proxy Action from Alerts View should open a dialog
|
||||
mockNewProxyAction.object.run(null);
|
||||
@@ -344,12 +345,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockEditProxyAction.setup(s => s.id).returns(() => EditProxyAction.ID);
|
||||
mockEditProxyAction.setup(s => s.label).returns(() => EditProxyAction.LABEL);
|
||||
should(mockEditProxyAction.object.id).equal(EditProxyAction.ID);
|
||||
should(mockEditProxyAction.object.label).equal(EditProxyAction.LABEL);
|
||||
assert.equal(mockEditProxyAction.object.id, EditProxyAction.ID);
|
||||
assert.equal(mockEditProxyAction.object.label, EditProxyAction.LABEL);
|
||||
|
||||
// Edit Proxy Action from Proxies View should open a dialog
|
||||
mockEditProxyAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -363,12 +364,12 @@ suite('Job Management Actions', () => {
|
||||
});
|
||||
mockDeleteProxyAction.setup(s => s.id).returns(() => DeleteProxyAction.ID);
|
||||
mockDeleteProxyAction.setup(s => s.label).returns(() => DeleteProxyAction.LABEL);
|
||||
should(mockDeleteProxyAction.object.id).equal(DeleteProxyAction.ID);
|
||||
should(mockDeleteProxyAction.object.label).equal(DeleteProxyAction.LABEL);
|
||||
assert.equal(mockDeleteProxyAction.object.id, DeleteProxyAction.ID);
|
||||
assert.equal(mockDeleteProxyAction.object.label, DeleteProxyAction.LABEL);
|
||||
|
||||
// Delete Proxy Action should call job management service
|
||||
mockDeleteProxyAction.object.run(null);
|
||||
should(commandServiceCalled).equal(true);
|
||||
assert(commandServiceCalled);
|
||||
mockJobManagementService.verify(s => s.deleteProxy(null, null), TypeMoq.Times.once());
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -29,6 +29,7 @@ import { TestConfigurationService } from 'vs/platform/configuration/test/common/
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
class TestParsedArgs implements ParsedArgs {
|
||||
[arg: string]: any;
|
||||
@@ -233,7 +234,7 @@ suite('commandLineService tests', () => {
|
||||
await contribution.processCommandLine(args);
|
||||
connectionManagementService.verifyAll();
|
||||
commandService.verifyAll();
|
||||
should(capturedArgs).be.undefined();
|
||||
assert(isUndefinedOrNull(capturedArgs));
|
||||
});
|
||||
|
||||
|
||||
@@ -269,8 +270,8 @@ suite('commandLineService tests', () => {
|
||||
await contribution.processCommandLine(args);
|
||||
connectionManagementService.verifyAll();
|
||||
commandService.verifyAll();
|
||||
should(actualProfile).not.be.undefined();
|
||||
should(actualProfile.connectionProfile.serverName).equal(args.server);
|
||||
assert(!isUndefinedOrNull(actualProfile));
|
||||
assert.equal(actualProfile.connectionProfile.serverName, args.server);
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as os from 'os';
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { ConnectionManagementService } from 'sql/platform/connection/browser/connectionManagementService';
|
||||
@@ -147,9 +147,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
let notebookEditorModel = await createTextEditorModel(this);
|
||||
notebookEditorModel.replaceEntireTextEditorModel(notebookModel, undefined);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineCount()).equal(6);
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(5)).equal(' "cells": []');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(2)).equal(' "metadata": {},');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineCount(), 6);
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(5), ' "cells": []');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(2), ' "metadata": {},');
|
||||
});
|
||||
|
||||
test('should replace entire text model for add cell (0 -> 1 cells)', async function (): Promise<void> {
|
||||
@@ -166,15 +166,15 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for execution count change', async function (): Promise<void> {
|
||||
@@ -190,9 +190,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 0');
|
||||
|
||||
newCell.executionCount = 1;
|
||||
contentChange = {
|
||||
@@ -203,13 +203,13 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 1');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26)).equal(' }');
|
||||
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), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
newCell.executionCount = 10;
|
||||
contentChange = {
|
||||
@@ -219,8 +219,8 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 10');
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 10');
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
newCell.executionCount = 15;
|
||||
contentChange = {
|
||||
@@ -230,8 +230,8 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 15');
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 15');
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
newCell.executionCount = 105;
|
||||
contentChange = {
|
||||
@@ -241,8 +241,8 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellExecuted);
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 105');
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25), ' "execution_count": 105');
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for clear output', async function (): Promise<void> {
|
||||
@@ -258,9 +258,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellOutputCleared,
|
||||
@@ -270,13 +270,13 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputCleared);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(15)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(16)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for multiline source change', async function (): Promise<void> {
|
||||
@@ -292,9 +292,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellSourceUpdated,
|
||||
@@ -312,17 +312,17 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "This is a test\\n",');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' "Line 2 test\\n",');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(11)).equal(' "Line 3 test"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(16)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(27)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(28)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(28), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for single line source change', async function (): Promise<void> {
|
||||
@@ -338,9 +338,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellSourceUpdated,
|
||||
@@ -358,15 +358,15 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "This is a test"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for single line source change then delete', async function (): Promise<void> {
|
||||
@@ -382,12 +382,12 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' ""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
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": [');
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellSourceUpdated,
|
||||
@@ -404,7 +404,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellSourceUpdated,
|
||||
@@ -422,15 +422,15 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' ""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for multiline source delete', async function (): Promise<void> {
|
||||
@@ -447,7 +447,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellSourceUpdated,
|
||||
@@ -464,14 +464,14 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "This is a test\\n",');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' "Line 2 test\\n",');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(11)).equal(' "Line 3 test"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
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 + '"');
|
||||
|
||||
contentChange = {
|
||||
changeType: NotebookChangeType.CellSourceUpdated,
|
||||
@@ -488,12 +488,12 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "Tt"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
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 + '"');
|
||||
});
|
||||
|
||||
test('should not replace entire text model and affect only edited cell', async function (): Promise<void> {
|
||||
@@ -518,7 +518,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
}
|
||||
|
||||
contentChange = {
|
||||
@@ -535,20 +535,20 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellSourceUpdated);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8 + i * 21)).equal(' "source": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(8 + i * 21), ' "source": [');
|
||||
if (i === 7) {
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21)).equal(' "This is a test"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12 + i * 21)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
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 + '"');
|
||||
} else {
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21)).equal(' ""');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9 + i * 21), ' ""');
|
||||
}
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10 + i * 21)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14 + i * 21)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25 + i * 21)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26 + i * 21)).startWith(' }');
|
||||
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": 0');
|
||||
assert(notebookEditorModel.editorModel.textEditorModel.getLineContent(26 + i * 21).startsWith(' }'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -565,9 +565,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
|
||||
|
||||
newCell[<any>'_outputs'] = newCell.outputs.concat(newCell.outputs);
|
||||
|
||||
@@ -578,16 +578,16 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(23)).equal(' }, {');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(31)).equal('}');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(32)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(33)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(34)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(34), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
test('should not insert update at incorrect location', async function (): Promise<void> {
|
||||
await createNewNotebookModel();
|
||||
@@ -602,9 +602,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
cellIndex: 0
|
||||
};
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [');
|
||||
|
||||
// First update the model with unmatched brackets
|
||||
let newUnmatchedBracketOutput: nb.IStreamResult = { output_type: 'stream', name: 'stdout', text: '[0em' };
|
||||
@@ -617,16 +617,16 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26)).equal(' "text": "[0em"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(27)).equal('}');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(28)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(29)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(30)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(30), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
// Now test updating the model after an unmatched bracket was previously output
|
||||
let newBracketlessOutput: nb.IStreamResult = { output_type: 'stream', name: 'stdout', text: 'test test test' };
|
||||
@@ -639,15 +639,15 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(32)).equal(' "text": "test test test"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(33)).equal(' }');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(34)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(35)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(36)).equal(' }');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(37)).equal(' ]');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(38)).equal('}');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(36), ' }');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(37), ' ]');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(38), '}');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for output changes (1st update)', async function (): Promise<void> {
|
||||
@@ -667,9 +667,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [],');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
|
||||
|
||||
// add output
|
||||
newCell[<any>'_outputs'] = previousOutputs;
|
||||
@@ -681,14 +681,14 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellOutputUpdated);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(23)).equal('}');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(25)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(26)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(26), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with double quotes', async function (): Promise<void> {
|
||||
@@ -700,10 +700,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '"This text is in quotes"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\\"This text is in quotes\\""');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"This text is in quotes\\""');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with many double quotes', async function (): Promise<void> {
|
||||
@@ -715,10 +715,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '""""""""""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\\"\\"\\"\\"\\"\\"\\"\\"\\"\\""');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"\\"\\"\\"\\"\\"\\"\\"\\"\\""');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with many backslashes', async function (): Promise<void> {
|
||||
@@ -730,10 +730,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '\\\\\\\\\\');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\\\\\\\\\\\\\\\\\\\\\"');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\\\\\\\\\\\\\\\\\\\\"');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with many backslashes and double quotes', async function (): Promise<void> {
|
||||
@@ -745,10 +745,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '\"\"\"\"\"\"\"\"\"\"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\""');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\"\\\""');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with no special characters', async function (): Promise<void> {
|
||||
@@ -760,10 +760,10 @@ 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?');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "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?"');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with variety of characters', async function (): Promise<void> {
|
||||
@@ -775,10 +775,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '`~1!2@3#4$5%6^7&8*9(0)-_=+[{]}\\|;:",<.>/?\'');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "`~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)-_=+[{]}\\\\|;:\\",<.>/?\'"');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with single quotes', async function (): Promise<void> {
|
||||
@@ -790,10 +790,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '\'\'\'\'');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\'\'\'\'"');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\'\'\'\'"');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with empty content', async function (): Promise<void> {
|
||||
@@ -805,10 +805,10 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' ""');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' ""');
|
||||
|
||||
ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel, newCell);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with multiline content', async function (): Promise<void> {
|
||||
@@ -820,17 +820,17 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '"test"' + os.EOL + 'test""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\\"test\\"\\n",');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"test\\"\\n",');
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' "test\\"\\""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(11)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(13)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(15)).equal(' "outputs": [],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(16)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(17)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(17), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
test('should not replace entire text model for content change with multiline content different escaped characters', async function (): Promise<void> {
|
||||
@@ -842,17 +842,17 @@ suite('Notebook Editor Model', function (): void {
|
||||
setupTextEditorModelWithEmptyOutputs(notebookEditorModel, newCell);
|
||||
|
||||
addTextToBeginningOfTextEditorModel(notebookEditorModel, newCell, '"""""test"' + os.EOL + '"""""""test\\""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(9)).equal(' "\\"\\"\\"\\"\\"test\\"\\n",');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(9), ' "\\"\\"\\"\\"\\"test\\"\\n",');
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' "\\"\\"\\"\\"\\"\\"\\"test\\\\\\"\\""');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(11)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(13)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(15)).equal(' "outputs": [],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(16)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(17)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(17), ' }');
|
||||
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(false);
|
||||
assert(!notebookEditorModel.lastEditFullReplacement);
|
||||
});
|
||||
|
||||
async function createNewNotebookModel() {
|
||||
@@ -881,9 +881,9 @@ suite('Notebook Editor Model', function (): void {
|
||||
};
|
||||
|
||||
notebookEditorModel.updateModel(contentChange, NotebookChangeType.CellsModified);
|
||||
should(notebookEditorModel.lastEditFullReplacement).equal(true);
|
||||
assert(notebookEditorModel.lastEditFullReplacement);
|
||||
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [],');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14), ' "outputs": [],');
|
||||
}
|
||||
|
||||
function addTextToBeginningOfTextEditorModel(notebookEditorModel: NotebookEditorModel, newCell: ICellModel, textToAdd: string) {
|
||||
@@ -905,11 +905,11 @@ suite('Notebook Editor Model', function (): void {
|
||||
}
|
||||
|
||||
function ensureStaticContentInOneLineCellIsCorrect(notebookEditorModel: NotebookEditorModel, newCell: ICellModel) {
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(8)).equal(' "source": [');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(10)).equal(' ],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(12)).equal(' "azdata_cell_guid": "' + newCell.cellGuid + '"');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(14)).equal(' "outputs": [],');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(15)).equal(' "execution_count": 0');
|
||||
should(notebookEditorModel.editorModel.textEditorModel.getLineContent(16)).equal(' }');
|
||||
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": 0');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(16), ' }');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import { nb } from 'azdata';
|
||||
import * as assert from 'assert';
|
||||
|
||||
import * as objects from 'vs/base/common/objects';
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Deferred } from 'sql/base/common/promise';
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
let instantiationService: IInstantiationService;
|
||||
|
||||
@@ -28,16 +29,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);
|
||||
should(cell.cellType).equal(CellTypes.Code);
|
||||
should(cell.source).equal('');
|
||||
assert.equal(cell.cellType, CellTypes.Code);
|
||||
assert.equal(cell.source, '');
|
||||
});
|
||||
|
||||
test('Should update values', async function (): Promise<void> {
|
||||
let cell = factory.createCell(undefined, undefined);
|
||||
cell.setOverrideLanguage('sql');
|
||||
should(cell.language).equal('sql');
|
||||
assert.equal(cell.language, 'sql');
|
||||
cell.source = 'abcd';
|
||||
should(JSON.stringify(cell.source)).equal(JSON.stringify(['abcd']));
|
||||
assert.equal(JSON.stringify(cell.source), JSON.stringify(['abcd']));
|
||||
});
|
||||
|
||||
test('Should match ICell values if defined', async function (): Promise<void> {
|
||||
@@ -54,11 +55,11 @@ suite('Cell Model', function (): void {
|
||||
execution_count: 1
|
||||
};
|
||||
let cell = factory.createCell(cellData, undefined);
|
||||
should(cell.cellType).equal(cellData.cell_type);
|
||||
should(JSON.stringify(cell.source)).equal(JSON.stringify([cellData.source]));
|
||||
should(cell.outputs).have.length(1);
|
||||
should(cell.outputs[0].output_type).equal('stream');
|
||||
should((<nb.IStreamResult>cell.outputs[0]).text).equal('Some output');
|
||||
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');
|
||||
});
|
||||
|
||||
|
||||
@@ -76,7 +77,7 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(cell.language).equal('python');
|
||||
assert.equal(cell.language, 'python');
|
||||
});
|
||||
|
||||
test('Should set cell language to python if defined as pyspark in languageInfo', async function (): Promise<void> {
|
||||
@@ -93,7 +94,7 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(cell.language).equal('python');
|
||||
assert.equal(cell.language, 'python');
|
||||
});
|
||||
|
||||
test('Should keep cell language as python if cell has language override', async function (): Promise<void> {
|
||||
@@ -110,7 +111,7 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(cell.language).equal('python');
|
||||
assert.equal(cell.language, 'python');
|
||||
});
|
||||
|
||||
test('Should set cell language to python if no language defined', async function (): Promise<void> {
|
||||
@@ -127,7 +128,7 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(cell.language).equal('python');
|
||||
assert.equal(cell.language, 'python');
|
||||
});
|
||||
|
||||
test('Should allow source of type string[] with length 1', async function (): Promise<void> {
|
||||
@@ -144,9 +145,9 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(Array.isArray(cell.source)).equal(true);
|
||||
should(cell.source.length).equal(1);
|
||||
should(cell.source[0]).equal('print(1)');
|
||||
assert(Array.isArray(cell.source));
|
||||
assert.equal(cell.source.length, 1);
|
||||
assert.equal(cell.source[0], 'print(1)');
|
||||
});
|
||||
|
||||
test('Should allow source of type string', async function (): Promise<void> {
|
||||
@@ -163,8 +164,8 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(Array.isArray(cell.source)).equal(true);
|
||||
should(JSON.stringify(cell.source)).equal(JSON.stringify(['print(1)']));
|
||||
assert(Array.isArray(cell.source));
|
||||
assert.equal(JSON.stringify(cell.source), JSON.stringify(['print(1)']));
|
||||
});
|
||||
|
||||
test('Should allow source of type string with newline and split it', async function (): Promise<void> {
|
||||
@@ -181,10 +182,10 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(Array.isArray(cell.source)).equal(true);
|
||||
should(cell.source.length).equal(2);
|
||||
should(cell.source[0]).equal('print(1)\n');
|
||||
should(cell.source[1]).equal('print(2)');
|
||||
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)');
|
||||
});
|
||||
|
||||
test('Should allow source of type string with Windows style newline and split it', async function (): Promise<void> {
|
||||
@@ -201,10 +202,10 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(Array.isArray(cell.source)).equal(true);
|
||||
should(cell.source.length).equal(2);
|
||||
should(cell.source[0]).equal('print(1)\r\n');
|
||||
should(cell.source[1]).equal('print(2)');
|
||||
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)');
|
||||
});
|
||||
|
||||
test('Should allow source of type string[] with length 2', async function (): Promise<void> {
|
||||
@@ -221,10 +222,10 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(Array.isArray(cell.source)).equal(true);
|
||||
should(cell.source.length).equal(2);
|
||||
should(cell.source[0]).equal('print(1)\n');
|
||||
should(cell.source[1]).equal('print(2)');
|
||||
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)');
|
||||
});
|
||||
|
||||
test('Should allow empty string source', async function (): Promise<void> {
|
||||
@@ -241,8 +242,8 @@ suite('Cell Model', function (): void {
|
||||
mimetype: ''
|
||||
});
|
||||
let cell = factory.createCell(cellData, { notebook: notebookModel, isTrusted: false });
|
||||
should(Array.isArray(cell.source)).equal(true);
|
||||
should(JSON.stringify(cell.source)).equal(JSON.stringify(['']));
|
||||
assert(Array.isArray(cell.source));
|
||||
assert.equal(JSON.stringify(cell.source), JSON.stringify(['']));
|
||||
});
|
||||
|
||||
test('Should parse metadata\'s hide_input tag correctly', async function (): Promise<void> {
|
||||
@@ -257,46 +258,46 @@ suite('Cell Model', function (): void {
|
||||
};
|
||||
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
|
||||
should(model.isCollapsed).be.false();
|
||||
assert(!model.isCollapsed);
|
||||
model.isCollapsed = true;
|
||||
should(model.isCollapsed).be.true();
|
||||
assert(model.isCollapsed);
|
||||
model.isCollapsed = false;
|
||||
should(model.isCollapsed).be.false();
|
||||
assert(!model.isCollapsed);
|
||||
|
||||
let modelJson = model.toJSON();
|
||||
should(modelJson.metadata.tags).not.be.undefined();
|
||||
should(modelJson.metadata.tags).not.containEql('hide_input');
|
||||
assert(!isUndefinedOrNull(modelJson.metadata.tags));
|
||||
assert(!modelJson.metadata.tags.includes('hide_input'));
|
||||
|
||||
contents.metadata = {
|
||||
tags: ['hide_input']
|
||||
};
|
||||
model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
|
||||
should(model.isCollapsed).be.true();
|
||||
assert(model.isCollapsed);
|
||||
model.isCollapsed = false;
|
||||
should(model.isCollapsed).be.false();
|
||||
assert(!model.isCollapsed);
|
||||
model.isCollapsed = true;
|
||||
should(model.isCollapsed).be.true();
|
||||
assert(model.isCollapsed);
|
||||
|
||||
modelJson = model.toJSON();
|
||||
should(modelJson.metadata.tags).not.be.undefined();
|
||||
should(modelJson.metadata.tags).containEql('hide_input');
|
||||
assert(!isUndefinedOrNull(modelJson.metadata.tags));
|
||||
assert(modelJson.metadata.tags.includes('hide_input'));
|
||||
|
||||
contents.metadata = {
|
||||
tags: ['not_a_real_tag']
|
||||
};
|
||||
model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
modelJson = model.toJSON();
|
||||
should(modelJson.metadata.tags).not.be.undefined();
|
||||
should(modelJson.metadata.tags).not.containEql('hide_input');
|
||||
assert(!isUndefinedOrNull(modelJson.metadata.tags));
|
||||
assert(!modelJson.metadata.tags.includes('hide_input'));
|
||||
|
||||
contents.metadata = {
|
||||
tags: ['not_a_real_tag', 'hide_input']
|
||||
};
|
||||
model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
modelJson = model.toJSON();
|
||||
should(modelJson.metadata.tags).not.be.undefined();
|
||||
should(modelJson.metadata.tags).containEql('hide_input');
|
||||
assert(!isUndefinedOrNull(modelJson.metadata.tags));
|
||||
assert(modelJson.metadata.tags.includes('hide_input'));
|
||||
});
|
||||
|
||||
test('Should emit event after collapsing cell', async function (): Promise<void> {
|
||||
@@ -310,7 +311,7 @@ suite('Cell Model', function (): void {
|
||||
source: ''
|
||||
};
|
||||
let model = factory.createCell(contents, { notebook: notebookModel, isTrusted: false });
|
||||
should(model.isCollapsed).be.false();
|
||||
assert(!model.isCollapsed);
|
||||
|
||||
let createCollapsePromise = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -321,16 +322,16 @@ suite('Cell Model', function (): void {
|
||||
});
|
||||
};
|
||||
|
||||
should(model.isCollapsed).be.false();
|
||||
assert(!model.isCollapsed);
|
||||
let collapsePromise = createCollapsePromise();
|
||||
model.isCollapsed = true;
|
||||
let isCollapsed = await collapsePromise;
|
||||
should(isCollapsed).be.true();
|
||||
assert(isCollapsed);
|
||||
|
||||
collapsePromise = createCollapsePromise();
|
||||
model.isCollapsed = false;
|
||||
isCollapsed = await collapsePromise;
|
||||
should(isCollapsed).be.false();
|
||||
assert(!isCollapsed);
|
||||
});
|
||||
|
||||
suite('Model Future handling', function (): void {
|
||||
@@ -379,8 +380,8 @@ suite('Cell Model', function (): void {
|
||||
cell.setFuture(future.object);
|
||||
|
||||
// Then I expect outputs to have been cleared
|
||||
should(outputs).have.length(0);
|
||||
should(onReply).not.be.undefined();
|
||||
assert.equal(outputs.length, 0);
|
||||
assert(!isUndefinedOrNull(onReply));
|
||||
// ... And when I send an IoPub message
|
||||
let message: nb.IIOPubMessage = {
|
||||
channel: 'iopub',
|
||||
@@ -396,13 +397,13 @@ suite('Cell Model', function (): void {
|
||||
};
|
||||
onIopub.handle(message);
|
||||
// Then I expect an output to be added
|
||||
should(outputs).have.length(1);
|
||||
should(outputs[0].output_type).equal('stream');
|
||||
assert.equal(outputs.length, 1);
|
||||
assert.equal(outputs[0].output_type, 'stream');
|
||||
|
||||
message = objects.deepClone(message);
|
||||
message.header.msg_type = 'display_data';
|
||||
onIopub.handle(message);
|
||||
should(outputs[1].output_type).equal('display_data');
|
||||
assert.equal(outputs[1].output_type, 'display_data');
|
||||
});
|
||||
|
||||
test('stdin should return void if no handler registered', async () => {
|
||||
@@ -414,7 +415,7 @@ suite('Cell Model', function (): void {
|
||||
cell.setFuture(future.object);
|
||||
|
||||
// Then I expect stdIn to have been hooked up
|
||||
should(onStdIn).not.be.undefined();
|
||||
assert(!isUndefinedOrNull(onStdIn));
|
||||
// ... And when I send a stdIn request message
|
||||
let result = onStdIn.handle(stdInDefaultMessage);
|
||||
// Then I expect the promise to resolve
|
||||
@@ -443,9 +444,9 @@ suite('Cell Model', function (): void {
|
||||
// Then I expect promise to resolve since it should wait on upstream handling
|
||||
await result;
|
||||
// And I expect message to have been passed upstream and no message sent from the cell
|
||||
should(stdInMessage).not.be.undefined();
|
||||
should(stdInMessage.content.prompt).equal(stdInDefaultMessage.content.prompt);
|
||||
should(stdInMessage.content.password).equal(stdInDefaultMessage.content.password);
|
||||
assert(!isUndefinedOrNull(stdInMessage));
|
||||
assert.equal(stdInMessage.content.prompt, stdInDefaultMessage.content.prompt);
|
||||
assert.equal(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 () => {
|
||||
@@ -498,8 +499,8 @@ suite('Cell Model', function (): void {
|
||||
onIopub.handle(message);
|
||||
//Output array's length should be 1
|
||||
//'transient' tag should no longer exist in the output
|
||||
should(outputs).have.length(1);
|
||||
should(outputs[0]['transient']).be.undefined();
|
||||
assert.equal(outputs.length, 1);
|
||||
assert(isUndefinedOrNull(outputs[0]['transient']));
|
||||
});
|
||||
|
||||
test('should dispose old future', async () => {
|
||||
@@ -519,10 +520,10 @@ suite('Cell Model', function (): void {
|
||||
});
|
||||
|
||||
let cell = factory.createCell(undefined, { notebook: notebookModel, isTrusted: false });
|
||||
should(cell.cellGuid).not.be.undefined();
|
||||
should(cell.cellGuid.length).equal(36);
|
||||
assert(!isUndefinedOrNull(cell.cellGuid));
|
||||
assert.equal(cell.cellGuid.length, 36);
|
||||
let cellJson = cell.toJSON();
|
||||
should(cellJson.metadata.azdata_cell_guid).not.be.undefined();
|
||||
assert(!isUndefinedOrNull(cellJson.metadata.azdata_cell_guid));
|
||||
});
|
||||
|
||||
test('should include azdata_cell_guid in metadata', async () => {
|
||||
@@ -534,7 +535,7 @@ suite('Cell Model', function (): void {
|
||||
|
||||
let cell = factory.createCell(undefined, { notebook: notebookModel, isTrusted: false });
|
||||
let cellJson = cell.toJSON();
|
||||
should(cellJson.metadata.azdata_cell_guid).not.be.undefined();
|
||||
assert(!isUndefinedOrNull(cellJson.metadata.azdata_cell_guid));
|
||||
});
|
||||
|
||||
// This is critical for the notebook editor model to parse changes correctly
|
||||
@@ -549,16 +550,16 @@ 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');
|
||||
should(contentSplit.length).equal(9);
|
||||
should(contentSplit[0].trim().startsWith('{')).equal(true);
|
||||
should(contentSplit[1].trim().startsWith('"cell_type": "code",')).equal(true);
|
||||
should(contentSplit[2].trim().startsWith('"source": ""')).equal(true);
|
||||
should(contentSplit[3].trim().startsWith('"metadata": {')).equal(true);
|
||||
should(contentSplit[4].trim().startsWith('"azdata_cell_guid": "')).equal(true);
|
||||
should(contentSplit[5].trim().startsWith('}')).equal(true);
|
||||
should(contentSplit[6].trim().startsWith('"outputs": []')).equal(true);
|
||||
should(contentSplit[7].trim().startsWith('"execution_count": 0')).equal(true);
|
||||
should(contentSplit[8].trim().startsWith('}')).equal(true);
|
||||
assert.equal(contentSplit.length, 9);
|
||||
assert(contentSplit[0].trim().startsWith('{'));
|
||||
assert(contentSplit[1].trim().startsWith('"cell_type": "code",'));
|
||||
assert(contentSplit[2].trim().startsWith('"source": ""'));
|
||||
assert(contentSplit[3].trim().startsWith('"metadata": {'));
|
||||
assert(contentSplit[4].trim().startsWith('"azdata_cell_guid": "'));
|
||||
assert(contentSplit[5].trim().startsWith('}'));
|
||||
assert(contentSplit[6].trim().startsWith('"outputs": []'));
|
||||
assert(contentSplit[7].trim().startsWith('"execution_count": 0'));
|
||||
assert(contentSplit[8].trim().startsWith('}'));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -3,17 +3,18 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import { nb } from 'azdata';
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
import { ClientSession } from 'sql/workbench/parts/notebook/browser/models/clientSession';
|
||||
import { SessionManager, EmptySession } from 'sql/workbench/services/notebook/browser/sessionManager';
|
||||
import { SessionManager } from 'sql/workbench/services/notebook/browser/sessionManager';
|
||||
import { NotebookManagerStub, ServerManagerStub } from './common';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
suite('Client Session', function (): void {
|
||||
let path = URI.file('my/notebook.ipynb');
|
||||
@@ -50,42 +51,42 @@ suite('Client Session', function (): void {
|
||||
});
|
||||
|
||||
test('Should set path, isReady and ready on construction', function (): void {
|
||||
should(session.notebookUri).equal(path);
|
||||
should(session.ready).not.be.undefined();
|
||||
should(session.isReady).be.false();
|
||||
should(session.status).equal('starting');
|
||||
should(session.isInErrorState).be.false();
|
||||
should(session.errorMessage).be.undefined();
|
||||
assert.equal(session.notebookUri, path);
|
||||
assert(!isUndefinedOrNull(session.ready));
|
||||
assert(!session.isReady);
|
||||
assert.equal(session.status, 'starting');
|
||||
assert(!session.isInErrorState);
|
||||
assert(isUndefinedOrNull(session.errorMessage));
|
||||
});
|
||||
|
||||
test('Should call on serverManager startup if set', async function (): Promise<void> {
|
||||
// Given I have a serverManager that starts successfully
|
||||
serverManager.result = Promise.resolve();
|
||||
should(session.isReady).be.false();
|
||||
assert(!session.isReady);
|
||||
|
||||
// When I kick off initialization
|
||||
await session.initialize();
|
||||
|
||||
// Then I expect ready to be completed too
|
||||
await session.ready;
|
||||
should(serverManager.calledStart).be.true();
|
||||
should(session.isReady).be.true();
|
||||
assert(serverManager.calledStart);
|
||||
assert(session.isReady);
|
||||
});
|
||||
|
||||
test('Should go to error state if serverManager startup fails', async function (): Promise<void> {
|
||||
// Given I have a serverManager that fails to start
|
||||
serverManager.result = Promise.reject('error');
|
||||
should(session.isInErrorState).be.false();
|
||||
assert(!session.isInErrorState);
|
||||
|
||||
// When I initialize
|
||||
await session.initialize();
|
||||
|
||||
// Then I expect ready to complete, but isInErrorState to be true
|
||||
await session.ready;
|
||||
should(session.isReady).be.true();
|
||||
should(serverManager.calledStart).be.true();
|
||||
should(session.isInErrorState).be.true();
|
||||
should(session.errorMessage).equal('error');
|
||||
assert(session.isReady);
|
||||
assert(serverManager.calledStart);
|
||||
assert(session.isInErrorState);
|
||||
assert.equal(session.errorMessage, 'error');
|
||||
});
|
||||
|
||||
test('Should be ready when session manager is ready', async function (): Promise<void> {
|
||||
@@ -99,8 +100,8 @@ suite('Client Session', function (): void {
|
||||
await session.initialize();
|
||||
|
||||
// Then
|
||||
should(session.isReady).be.true();
|
||||
should(session.isInErrorState).be.false();
|
||||
assert(session.isReady);
|
||||
assert(!session.isInErrorState);
|
||||
await session.ready;
|
||||
});
|
||||
|
||||
@@ -116,8 +117,8 @@ suite('Client Session', function (): void {
|
||||
|
||||
// Then
|
||||
await session.ready;
|
||||
should(session.isReady).be.true();
|
||||
should(session.isInErrorState).be.true();
|
||||
assert(session.isReady);
|
||||
assert(session.isInErrorState);
|
||||
});
|
||||
|
||||
test('Should go to error state if sessionManager fails', async function (): Promise<void> {
|
||||
@@ -129,9 +130,9 @@ suite('Client Session', function (): void {
|
||||
await session.initialize();
|
||||
|
||||
// Then
|
||||
should(session.isReady).be.true();
|
||||
should(session.isInErrorState).be.true();
|
||||
should(session.errorMessage).equal('error');
|
||||
assert(session.isReady);
|
||||
assert(session.isInErrorState);
|
||||
assert.equal(session.errorMessage, 'error');
|
||||
});
|
||||
|
||||
// test('Should start session automatically if kernel preference requests it', async function (): Promise<void> {
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import { nb } from 'azdata';
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as tempWrite from 'temp-write';
|
||||
@@ -16,6 +16,7 @@ import { TestFileService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { IFileService, IReadFileOptions, IFileContent, IWriteFileOptions, IFileStatWithMetadata } from 'vs/platform/files/common/files';
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { VSBuffer, VSBufferReadable } from 'vs/base/common/buffer';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
let expectedNotebookContent: nb.INotebookContents = {
|
||||
cells: [{
|
||||
@@ -36,12 +37,12 @@ let expectedNotebookContent: nb.INotebookContents = {
|
||||
let notebookContentString = JSON.stringify(expectedNotebookContent);
|
||||
|
||||
function verifyMatchesExpectedNotebook(notebook: nb.INotebookContents): void {
|
||||
should(notebook.cells).have.length(1, 'Expected 1 cell');
|
||||
should(notebook.cells[0].cell_type).equal(CellTypes.Code);
|
||||
should(notebook.cells[0].source).equal(expectedNotebookContent.cells[0].source);
|
||||
should(notebook.metadata.kernelspec.name).equal(expectedNotebookContent.metadata.kernelspec.name);
|
||||
should(notebook.nbformat).equal(expectedNotebookContent.nbformat);
|
||||
should(notebook.nbformat_minor).equal(expectedNotebookContent.nbformat_minor);
|
||||
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);
|
||||
}
|
||||
|
||||
suite('Local Content Manager', function (): void {
|
||||
@@ -65,10 +66,10 @@ suite('Local Content Manager', function (): void {
|
||||
|
||||
test('Should return undefined if path is undefined', async function (): Promise<void> {
|
||||
let content = await contentManager.getNotebookContents(undefined);
|
||||
should(content).be.undefined();
|
||||
assert(isUndefinedOrNull(content));
|
||||
// tslint:disable-next-line:no-null-keyword
|
||||
content = await contentManager.getNotebookContents(null);
|
||||
should(content).be.undefined();
|
||||
assert(isUndefinedOrNull(content));
|
||||
});
|
||||
|
||||
test('Should throw if file does not exist', async function (): Promise<void> {
|
||||
@@ -126,6 +127,6 @@ 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];
|
||||
should(displayOutput.data['text/html']).equal('<div></div>');
|
||||
assert.equal(displayOutput.data['text/html'], '<div></div>');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import { nb } from 'azdata';
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
@@ -29,6 +29,7 @@ import { InstantiationService } from 'vs/platform/instantiation/common/instantia
|
||||
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { TestConnectionManagementService } from 'sql/platform/connection/test/common/testConnectionManagementService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
|
||||
let expectedNotebookContent: nb.INotebookContents = {
|
||||
cells: [{
|
||||
@@ -141,9 +142,9 @@ suite('notebook model', function (): void {
|
||||
await model.loadContents();
|
||||
|
||||
// Then I expect to have 0 code cell as the contents
|
||||
should(model.cells).have.length(0);
|
||||
assert.equal(model.cells.length, 0);
|
||||
// And Trust should be false by default
|
||||
should(model.trustedMode).be.false();
|
||||
assert(!model.trustedMode);
|
||||
});
|
||||
|
||||
test('Should use trusted state set in model load', async function (): Promise<void> {
|
||||
@@ -157,7 +158,7 @@ suite('notebook model', function (): void {
|
||||
await model.requestModelLoad();
|
||||
|
||||
// Then Trust should be true
|
||||
should(model.trustedMode).be.true();
|
||||
assert(model.trustedMode);
|
||||
});
|
||||
|
||||
// test('Should throw if model load fails', async function(): Promise<void> {
|
||||
@@ -246,29 +247,27 @@ suite('notebook model', function (): void {
|
||||
await model.startSession(notebookManagers[0]);
|
||||
|
||||
// Then I expect load to succeed
|
||||
should(model.clientSession).not.be.undefined();
|
||||
assert(!isUndefinedOrNull(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
|
||||
let kernelChangedArg: nb.IKernelChangedArgs = undefined;
|
||||
model.kernelChanged((kernel) => kernelChangedArg = kernel);
|
||||
await model.sessionLoadFinished;
|
||||
should(model.inErrorState).be.false();
|
||||
should(actualSession).equal(mockClientSession.object);
|
||||
should(model.clientSession).equal(mockClientSession.object);
|
||||
assert(!model.inErrorState);
|
||||
assert.equal(actualSession, mockClientSession.object);
|
||||
assert.equal(model.clientSession, mockClientSession.object);
|
||||
});
|
||||
|
||||
test('Should sanitize kernel display name when IP is included', async function (): Promise<void> {
|
||||
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, undefined);
|
||||
let displayName = 'PySpark (1.1.1.1)';
|
||||
let sanitizedDisplayName = model.sanitizeDisplayName(displayName);
|
||||
should(sanitizedDisplayName).equal('PySpark');
|
||||
assert.equal(sanitizedDisplayName, 'PySpark');
|
||||
});
|
||||
|
||||
test('Should sanitize kernel display name properly when IP is not included', async function (): Promise<void> {
|
||||
let model = new NotebookModel(defaultModelOptions, undefined, logService, undefined, undefined);
|
||||
let displayName = 'PySpark';
|
||||
let sanitizedDisplayName = model.sanitizeDisplayName(displayName);
|
||||
should(sanitizedDisplayName).equal('PySpark');
|
||||
assert.equal(sanitizedDisplayName, 'PySpark');
|
||||
});
|
||||
|
||||
test('Should notify on trust set', async function () {
|
||||
@@ -285,19 +284,8 @@ suite('notebook model', function (): void {
|
||||
model.trustedMode = true;
|
||||
|
||||
// Then content changed notification should be sent
|
||||
should(model.trustedMode).be.true();
|
||||
should(actualChanged).not.be.undefined();
|
||||
should(actualChanged.changeType).equal(NotebookChangeType.TrustChanged);
|
||||
assert(model.trustedMode);
|
||||
assert(!isUndefinedOrNull(actualChanged));
|
||||
assert.equal(actualChanged.changeType, NotebookChangeType.TrustChanged);
|
||||
});
|
||||
|
||||
function shouldHaveOneCell(model: NotebookModel): void {
|
||||
should(model.cells).have.length(1);
|
||||
verifyCellModel(model.cells[0], { cell_type: CellTypes.Code, source: 'insert into t1 values (c1, c2)', metadata: { language: 'python' }, execution_count: 1 });
|
||||
}
|
||||
|
||||
function verifyCellModel(cellModel: ICellModel, expected: nb.ICellContents): void {
|
||||
should(cellModel.cellType).equal(expected.cell_type);
|
||||
should(cellModel.source).equal(expected.source);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as should from 'should';
|
||||
import { IConnectionProfile } from 'azdata';
|
||||
import * as assert from 'assert';
|
||||
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
@@ -35,7 +35,7 @@ suite('notebookUtils', function (): void {
|
||||
connProfile.serverName = 'serverName';
|
||||
connProfile.databaseName = 'databaseName';
|
||||
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
|
||||
should(attachToNameFormatted).equal('serverName (databaseName)');
|
||||
assert.equal(attachToNameFormatted, 'serverName (databaseName)');
|
||||
});
|
||||
|
||||
test('Should format server name correctly for attach to', async function (): Promise<void> {
|
||||
@@ -43,7 +43,7 @@ suite('notebookUtils', function (): void {
|
||||
let connProfile = new ConnectionProfile(capabilitiesService, conn);
|
||||
connProfile.serverName = 'serverName';
|
||||
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
|
||||
should(attachToNameFormatted).equal('serverName');
|
||||
assert.equal(attachToNameFormatted, 'serverName');
|
||||
});
|
||||
|
||||
test('Should format server name correctly for attach to when database is undefined', async function (): Promise<void> {
|
||||
@@ -52,7 +52,7 @@ suite('notebookUtils', function (): void {
|
||||
connProfile.serverName = 'serverName';
|
||||
connProfile.databaseName = undefined;
|
||||
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
|
||||
should(attachToNameFormatted).equal('serverName');
|
||||
assert.equal(attachToNameFormatted, 'serverName');
|
||||
});
|
||||
|
||||
test('Should format server name as empty string when server/database are undefined', async function (): Promise<void> {
|
||||
@@ -61,27 +61,27 @@ suite('notebookUtils', function (): void {
|
||||
connProfile.serverName = undefined;
|
||||
connProfile.databaseName = undefined;
|
||||
let attachToNameFormatted = formatServerNameWithDatabaseNameForAttachTo(connProfile);
|
||||
should(attachToNameFormatted).equal('');
|
||||
assert.equal(attachToNameFormatted, '');
|
||||
});
|
||||
|
||||
test('Should extract server name when no database specified', async function (): Promise<void> {
|
||||
let serverName = getServerFromFormattedAttachToName('serverName');
|
||||
let databaseName = getDatabaseFromFormattedAttachToName('serverName');
|
||||
should(serverName).equal('serverName');
|
||||
should(databaseName).equal('');
|
||||
assert.equal(serverName, 'serverName');
|
||||
assert.equal(databaseName, '');
|
||||
});
|
||||
|
||||
test('Should extract server and database name', async function (): Promise<void> {
|
||||
let serverName = getServerFromFormattedAttachToName('serverName (databaseName)');
|
||||
let databaseName = getDatabaseFromFormattedAttachToName('serverName (databaseName)');
|
||||
should(serverName).equal('serverName');
|
||||
should(databaseName).equal('databaseName');
|
||||
assert.equal(serverName, 'serverName');
|
||||
assert.equal(databaseName, 'databaseName');
|
||||
});
|
||||
|
||||
test('Should extract server and database name with other parentheses', async function (): Promise<void> {
|
||||
let serverName = getServerFromFormattedAttachToName('serv()erName (databaseName)');
|
||||
let databaseName = getDatabaseFromFormattedAttachToName('serv()erName (databaseName)');
|
||||
should(serverName).equal('serv()erName');
|
||||
should(databaseName).equal('databaseName');
|
||||
assert.equal(serverName, 'serv()erName');
|
||||
assert.equal(databaseName, 'databaseName');
|
||||
});
|
||||
});
|
||||
|
||||
238
src/typings/should.d.ts
vendored
238
src/typings/should.d.ts
vendored
@@ -1,238 +0,0 @@
|
||||
// Type definitions for should.js
|
||||
|
||||
declare function should(obj: any): should.Assertion;
|
||||
|
||||
// node assert methods
|
||||
/*interface NodeAssert {
|
||||
fail(actual: any, expected: any, message?: string, operator?: string): void;
|
||||
ok(value: any, message?: string): void;
|
||||
equal(actual: any, expected: any, message?: string): void;
|
||||
notEqual(actual: any, expected: any, message?: string): void;
|
||||
deepEqual(actual: any, expected: any, message?: string): void;
|
||||
notDeepEqual(actual: any, expected: any, message?: string): void;
|
||||
strictEqual(actual: any, expected: any, message?: string): void;
|
||||
notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
throws(block: Function, message?: string): void;
|
||||
throws(block: Function, error: Function, message?: string): void;
|
||||
throws(block: Function, error: RegExp, message?: string): void;
|
||||
throws(block: Function, error: (err: any) => boolean, message?: string): void;
|
||||
|
||||
doesNotThrow(block: Function, message?: string): void;
|
||||
doesNotThrow(block: Function, error: Function, message?: string): void;
|
||||
doesNotThrow(block: Function, error: RegExp, message?: string): void;
|
||||
doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void;
|
||||
|
||||
ifError(value: any): void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface should extends NodeAssert, ShouldAssertExt {
|
||||
not: ShouldAssertExt;
|
||||
}*/
|
||||
|
||||
declare module should {
|
||||
interface ShouldAssertExt {
|
||||
exist(obj: any, msg?: string): void;
|
||||
exists(obj: any, msg?: string): void;
|
||||
}
|
||||
|
||||
function fail(actual: any, expected: any, message?: string, operator?: string): void;
|
||||
function ok(value: any, message?: string): void;
|
||||
function equal(actual: any, expected: any, message?: string): void;
|
||||
function notEqual(actual: any, expected: any, message?: string): void;
|
||||
function deepEqual(actual: any, expected: any, message?: string): void;
|
||||
function notDeepEqual(actual: any, expected: any, message?: string): void;
|
||||
function strictEqual(actual: any, expected: any, message?: string): void;
|
||||
function notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function throws(block: Function, message?: string): void;
|
||||
function throws(block: Function, error: Function, message?: string): void;
|
||||
function throws(block: Function, error: RegExp, message?: string): void;
|
||||
function throws(block: Function, error: (err: any) => boolean, message?: string): void;
|
||||
|
||||
function doesNotThrow(block: Function, message?: string): void;
|
||||
function doesNotThrow(block: Function, error: Function, message?: string): void;
|
||||
function doesNotThrow(block: Function, error: RegExp, message?: string): void;
|
||||
function doesNotThrow(block: Function, error: (err: any) => boolean, message?: string): void;
|
||||
|
||||
function ifError(value: any): void;
|
||||
|
||||
function exist(obj: any, msg?: string): void;
|
||||
function exists(obj: any, msg?: string): void;
|
||||
|
||||
const not: ShouldAssertExt;
|
||||
|
||||
interface Assertion {
|
||||
assert(expr: boolean): this;
|
||||
fail(): this;
|
||||
|
||||
not: this;
|
||||
any: this;
|
||||
only: this;
|
||||
|
||||
// bool
|
||||
true(message?: string): this;
|
||||
True(message?: string): this;
|
||||
|
||||
false(message?: string): this;
|
||||
False(message?: string): this;
|
||||
|
||||
ok(): this;
|
||||
|
||||
//chain
|
||||
an: this;
|
||||
of: this;
|
||||
a: this;
|
||||
and: this;
|
||||
be: this;
|
||||
been: this;
|
||||
has: this;
|
||||
have: this;
|
||||
with: this;
|
||||
is: this;
|
||||
which: this;
|
||||
the: this;
|
||||
it: this;
|
||||
|
||||
//contain
|
||||
containEql(obj: any): this;
|
||||
containDeepOrdered(obj: any): this;
|
||||
containDeep(obj: any): this;
|
||||
|
||||
// eql
|
||||
eql(obj: any, description?: string): this;
|
||||
eqls(obj: any, description?: string): this;
|
||||
deepEqual(obj: any, description?: string): this;
|
||||
|
||||
equal(obj: any, description?: string): this;
|
||||
equals(obj: any, description?: string): this;
|
||||
exactly(obj: any, description?: string): this;
|
||||
|
||||
equalOneOf(...objs: any[]): this;
|
||||
equalOneOf(obj: any[]): this;
|
||||
oneOf(...objs: any[]): this;
|
||||
oneOf(obj: any[]): this;
|
||||
|
||||
//error
|
||||
throw(): this;
|
||||
throw(msg: RegExp | string | Function, properties?: {}): this;
|
||||
throw(properties: {}): this;
|
||||
//TODO how to express generators???
|
||||
throwError(): this;
|
||||
throwError(msg: RegExp | string | Function, properties?: {}): this;
|
||||
throwError(properties: {}): this;
|
||||
|
||||
// match
|
||||
match(
|
||||
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
||||
description?: string
|
||||
): this;
|
||||
matchEach(
|
||||
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
||||
description?: string
|
||||
): this;
|
||||
matchEvery(
|
||||
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
||||
description?: string
|
||||
): this;
|
||||
matchAny(
|
||||
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
||||
description?: string
|
||||
): this;
|
||||
matchSome(
|
||||
obj: RegExp | ((value: any, key: any) => boolean) | ((value: any, key: any) => void) | {},
|
||||
description?: string
|
||||
): this;
|
||||
|
||||
//number
|
||||
NaN(): this;
|
||||
Infinity(): this;
|
||||
within(start: number, finish: number, description?: string): this;
|
||||
approximately(value: number, delta: number, description?: string): this;
|
||||
above(value: number, description?: string): this;
|
||||
greaterThan(value: number, description?: string): this;
|
||||
below(value: number, description?: string): this;
|
||||
lessThan(value: number, description?: string): this;
|
||||
aboveOrEqual(value: number, description?: string): this;
|
||||
greaterThanOrEqual(value: number, description?: string): this;
|
||||
belowOrEqual(value: number, description?: string): this;
|
||||
lessThanOrEqual(value: number, description?: string): this;
|
||||
|
||||
//promise
|
||||
Promise(): this;
|
||||
|
||||
fulfilled(): Promise<any>;
|
||||
resolved(): Promise<any>;
|
||||
rejected(): Promise<any>;
|
||||
|
||||
fulfilledWith(obj: any): Promise<any>;
|
||||
resolvedWith(obj: any): Promise<any>;
|
||||
rejectedWith(msg: RegExp | string | Error, properties?: {}): Promise<any>;
|
||||
rejectedWith(properties: {}): Promise<any>;
|
||||
finally: PromisedAssertion;
|
||||
eventually: PromisedAssertion;
|
||||
|
||||
// property
|
||||
propertyWithDescriptor(name: string, descriptor: {}): this;
|
||||
|
||||
property(name: string, value?: any): this;
|
||||
properties(...names: string[]): this;
|
||||
properties(names: string[]): this;
|
||||
properties(props: {}): this;
|
||||
|
||||
length(value: number, description?: string): this;
|
||||
lengthOf(value: number, description?: string): this;
|
||||
|
||||
ownProperty(name: string, description?: string): this;
|
||||
hasOwnProperty(name: string, description?: string): this;
|
||||
|
||||
empty(): this;
|
||||
|
||||
keys(...keys: any[]): this;
|
||||
key(key: any): this;
|
||||
|
||||
value(key: any, value: any): this;
|
||||
|
||||
size(value: number): this;
|
||||
|
||||
propertyByPath(...path: string[]): this;
|
||||
propertyByPath(path: string[]): this;
|
||||
|
||||
//string
|
||||
startWith(prefix: string, description?: string): this;
|
||||
endWith(postfix: string, description?: string): this;
|
||||
|
||||
//type
|
||||
Number(): this;
|
||||
arguments(): this;
|
||||
Arguments(): this;
|
||||
type(typeName: string, description?: string): this;
|
||||
instanceof(constructor: Function, description?: string): this;
|
||||
instanceOf(constructor: Function, description?: string): this;
|
||||
Function(): this;
|
||||
Object(): this;
|
||||
String(): this;
|
||||
Array(): this;
|
||||
Boolean(): this;
|
||||
Error(): this;
|
||||
Date(): this;
|
||||
null(): this;
|
||||
Null(): this;
|
||||
class(className: string): this;
|
||||
Class(className: string): this;
|
||||
undefined(): this;
|
||||
Undefined(): this;
|
||||
iterable(): this;
|
||||
iterator(): this;
|
||||
generator(): this;
|
||||
}
|
||||
|
||||
interface PromisedAssertion extends Assertion, PromiseLike<any> {}
|
||||
}
|
||||
|
||||
|
||||
declare module 'should' {
|
||||
export = should;
|
||||
}
|
||||
51
yarn.lock
51
yarn.lock
@@ -203,13 +203,6 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-5.5.0.tgz#146c2a29ee7d3bae4bf2fcb274636e264c813c45"
|
||||
integrity sha512-41qEJgBH/TWgo5NFSvBCJ1qkoi3Q6ONSF2avrHq1LVEZfYpdHmj0y9SuTK+u9ZhG1sYQKBL1AWXKyLWP4RaUoQ==
|
||||
|
||||
"@types/should@^13.0.0":
|
||||
version "13.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/should/-/should-13.0.0.tgz#96c00117f1896177848fdecfa336313c230c879e"
|
||||
integrity sha512-Mi6YZ2ABnnGGFMuiBDP0a8s1ZDCDNHqP97UH8TyDmCWuGGavpsFMfJnAMYaaqmDlSCOCNbVLHBrSDEOpx/oLhw==
|
||||
dependencies:
|
||||
should "*"
|
||||
|
||||
"@types/sinon@^1.16.36":
|
||||
version "1.16.36"
|
||||
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-1.16.36.tgz#74bb6ed7928597c1b3fb1b009005e94dc6eae357"
|
||||
@@ -7869,50 +7862,6 @@ shebang-regex@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3"
|
||||
integrity sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=
|
||||
|
||||
should-equal@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/should-equal/-/should-equal-2.0.0.tgz#6072cf83047360867e68e98b09d71143d04ee0c3"
|
||||
integrity sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==
|
||||
dependencies:
|
||||
should-type "^1.4.0"
|
||||
|
||||
should-format@^3.0.3:
|
||||
version "3.0.3"
|
||||
resolved "https://registry.yarnpkg.com/should-format/-/should-format-3.0.3.tgz#9bfc8f74fa39205c53d38c34d717303e277124f1"
|
||||
integrity sha1-m/yPdPo5IFxT04w01xcwPidxJPE=
|
||||
dependencies:
|
||||
should-type "^1.3.0"
|
||||
should-type-adaptors "^1.0.1"
|
||||
|
||||
should-type-adaptors@^1.0.1:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/should-type-adaptors/-/should-type-adaptors-1.1.0.tgz#401e7f33b5533033944d5cd8bf2b65027792e27a"
|
||||
integrity sha512-JA4hdoLnN+kebEp2Vs8eBe9g7uy0zbRo+RMcU0EsNy+R+k049Ki+N5tT5Jagst2g7EAja+euFuoXFCa8vIklfA==
|
||||
dependencies:
|
||||
should-type "^1.3.0"
|
||||
should-util "^1.0.0"
|
||||
|
||||
should-type@^1.3.0, should-type@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/should-type/-/should-type-1.4.0.tgz#0756d8ce846dfd09843a6947719dfa0d4cff5cf3"
|
||||
integrity sha1-B1bYzoRt/QmEOmlHcZ36DUz/XPM=
|
||||
|
||||
should-util@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/should-util/-/should-util-1.0.0.tgz#c98cda374aa6b190df8ba87c9889c2b4db620063"
|
||||
integrity sha1-yYzaN0qmsZDfi6h8mInCtNtiAGM=
|
||||
|
||||
should@*, should@^13.2.3:
|
||||
version "13.2.3"
|
||||
resolved "https://registry.yarnpkg.com/should/-/should-13.2.3.tgz#96d8e5acf3e97b49d89b51feaa5ae8d07ef58f10"
|
||||
integrity sha512-ggLesLtu2xp+ZxI+ysJTmNjh2U0TsC+rQ/pfED9bUZZ4DKefP27D+7YJVVTvKsmjLpIi9jAa7itwDGkDDmt1GQ==
|
||||
dependencies:
|
||||
should-equal "^2.0.0"
|
||||
should-format "^3.0.3"
|
||||
should-type "^1.4.0"
|
||||
should-type-adaptors "^1.0.1"
|
||||
should-util "^1.0.0"
|
||||
|
||||
sigmund@^1.0.1, sigmund@~1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/sigmund/-/sigmund-1.0.1.tgz#3ff21f198cad2175f9f3b781853fd94d0d19b590"
|
||||
|
||||
Reference in New Issue
Block a user