-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(service): Service skeleton - provider boots up
Doesn't do anything else yet, mind.
- Loading branch information
1 parent
772d5d5
commit 56883ad
Showing
6 changed files
with
47 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {} |
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,3 @@ | ||
module.exports = { | ||
description: 'Implements a local filestorage provider for the cloudstorage plugin.' | ||
} |
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,15 @@ | ||
class LocalFilestorage { | ||
boot (options) { | ||
const cloudstorage = cloudstorageService(options) | ||
cloudstorage.registerProvider(this) | ||
} | ||
} // class LocalFilestorage | ||
|
||
function cloudstorageService (options) { | ||
return options.bootedServices.cloudstorage | ||
} // cloudstorageService | ||
|
||
module.exports = { | ||
serviceClass: LocalFilestorage, | ||
bootAfter: ['cloudstorage'] | ||
} |
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 @@ | ||
module.exports = {} |
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,26 @@ | ||
/* eslint-env mocha */ | ||
|
||
const chai = require('chai') | ||
chai.use(require('dirty-chai')) | ||
const expect = chai.expect | ||
|
||
const LocalStorageService = require('../lib/components/services/localfilestorage').serviceClass | ||
|
||
describe('Boot localstorage service', () => { | ||
it('localstorage registers with cloudstorage on boot', () => { | ||
let registered = false | ||
const localstorage = new LocalStorageService() | ||
|
||
const options = { | ||
bootedServices: { | ||
cloudstorage: { | ||
registerProvider: provider => { registered = (provider === localstorage) } | ||
} | ||
} | ||
} | ||
|
||
localstorage.boot(options) | ||
|
||
expect(registered).to.be.true() | ||
}) | ||
}) |