-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document labels: use fields other than _id wherever possible (#569)
* Update third party notices for mongodb-extended-json. * Document labels: use fields other than _id wherever possible * Remove the number of calls to toString in finding the label * Force refresh a document's tree item post-update. Fixes #145 * Document labels : make private * Add setter for tsc -p * Changes based on feedback * Based on feedback * tsc fix * Feedback + tests * Add field to documentLabelFields. Kicks off CLA.
- Loading branch information
1 parent
3ea8080
commit e6fa015
Showing
9 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
|
||
import * as assert from 'assert'; | ||
import { getDocumentTreeItemLabel } from '../src/utils/vscodeUtils'; | ||
|
||
suite("Document Label Tests", () => { | ||
test("Non-zero number", () => { | ||
const doc = { name: 4, _id: "12345678901234567890123456789012" }; | ||
assert.equal(getDocumentTreeItemLabel(doc), 4); | ||
}); | ||
|
||
test("zero (number)", () => { | ||
const doc = { name: 0, _id: "12345678901234567890123456789012" }; | ||
assert.equal(getDocumentTreeItemLabel(doc), 0); | ||
}); | ||
|
||
test("Empty string", () => { | ||
const doc = { name: "", _id: "" }; | ||
assert.equal(getDocumentTreeItemLabel(doc), ""); | ||
}); | ||
|
||
test("Null", () => { | ||
const doc = { name: null, _id: "12345678901234567890123456789012" }; | ||
assert.equal(getDocumentTreeItemLabel(doc), doc._id); | ||
}); | ||
|
||
|
||
}); |