-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Warren James <warren.james@mongodb.com>
- Loading branch information
1 parent
a329748
commit b97132e
Showing
3 changed files
with
91 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { expect } from 'chai'; | ||
|
||
import { ListDatabasesOperation, MongoDBNamespace } from '../../mongodb'; | ||
|
||
const mockDB = { | ||
s: { | ||
namespace: { | ||
withCollection() { | ||
return new MongoDBNamespace('test', 'test'); | ||
} | ||
} | ||
} | ||
}; | ||
|
||
describe('ListDatabasesOperation', function () { | ||
describe('#constructor', function () { | ||
context('when nameOnly is provided', function () { | ||
context('when nameOnly is true', function () { | ||
it('sets nameOnly to true', function () { | ||
const operation = new ListDatabasesOperation(mockDB, { nameOnly: true }); | ||
expect(operation.options).to.have.property('nameOnly', true); | ||
}); | ||
}); | ||
|
||
context('when nameOnly is false', function () { | ||
it('sets nameOnly to false', function () { | ||
const operation = new ListDatabasesOperation(mockDB, { nameOnly: false }); | ||
expect(operation.options).to.have.property('nameOnly', false); | ||
}); | ||
}); | ||
}); | ||
|
||
context('when nameOnly is not specified', function () { | ||
it('nameOnly is undefined', function () { | ||
const operation = new ListDatabasesOperation(mockDB, {}); | ||
expect(operation.options).not.to.have.property('nameOnly'); | ||
}); | ||
}); | ||
}); | ||
}); |