mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Increased adapter manager test coverage
refs https://github.com/TryGhost/Toolbox/issues/384 - Boyscouting while having the context loaded. Getting to those 100% coverages one day!
This commit is contained in:
parent
a96a7340c0
commit
d0c45cbe9e
1 changed files with 23 additions and 0 deletions
|
@ -42,6 +42,29 @@ describe('AdapterManager', function () {
|
|||
}
|
||||
});
|
||||
|
||||
it('getAdapter throws if config does not contain adapter type key', function () {
|
||||
const pathsToAdapters = [
|
||||
'first/path'
|
||||
];
|
||||
|
||||
const loadAdapterFromPath = sinon.stub();
|
||||
const adapterManager = new AdapterManager({
|
||||
loadAdapterFromPath,
|
||||
pathsToAdapters
|
||||
});
|
||||
|
||||
adapterManager.registerAdapter('some_other_adapter_type', BaseMailAdapter);
|
||||
|
||||
try {
|
||||
adapterManager.getAdapter('mail', 'custom');
|
||||
should.fail(null, null, 'Should not have created');
|
||||
} catch (err) {
|
||||
should.exist(err);
|
||||
should.equal(err.errorType, 'NotFoundError');
|
||||
should.equal(err.message, 'Unknown adapter type mail. Please register adapter.');
|
||||
}
|
||||
});
|
||||
|
||||
it('Loads registered adapters in the order defined by the paths', function () {
|
||||
const pathsToAdapters = [
|
||||
'first/path',
|
||||
|
|
Loading…
Add table
Reference in a new issue