-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from RocketChat/develop
updating the code
- Loading branch information
Showing
25 changed files
with
285 additions
and
76 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:12.18.4-buster-slim | ||
FROM node:12.21.0-buster-slim | ||
|
||
LABEL maintainer="buildmaster@rocket.chat" | ||
|
||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM node:12.18.4-buster-slim | ||
FROM node:12.21.0-buster-slim | ||
|
||
LABEL maintainer="buildmaster@rocket.chat" | ||
|
||
|
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 |
---|---|---|
@@ -1 +1 @@ | ||
METEOR@1.11.1 | ||
METEOR@2.1 |
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,47 @@ | ||
/* eslint-env mocha */ | ||
import chai, { expect } from 'chai'; | ||
import spies from 'chai-spies'; | ||
import rewire from 'rewire'; | ||
|
||
chai.use(spies); | ||
|
||
describe('Raw Settings', () => { | ||
let rawModule; | ||
const cache = new Map(); | ||
|
||
before('rewire deps', () => { | ||
const spy = chai.spy(async (id) => { | ||
if (id === '1') { return 'some-setting-value'; } | ||
return null; | ||
}); | ||
|
||
rawModule = rewire('./raw'); | ||
rawModule.__set__('setFromDB', spy); | ||
rawModule.__set__('cache', cache); | ||
}); | ||
|
||
it('should get the value from database when it isnt in cache', async () => { | ||
const setting = await rawModule.getValue('1'); | ||
|
||
expect(setting).to.be.equal('some-setting-value'); | ||
}); | ||
|
||
it('should get the value from cache when its available', async () => { | ||
cache.set('2', 'supeer-setting'); | ||
const setting = await rawModule.getValue('2'); | ||
|
||
expect(setting).to.be.equal('supeer-setting'); | ||
}); | ||
|
||
it('should update the value in cache', async () => { | ||
await rawModule.updateValue('2', { value: 'not-super-setting' }); | ||
|
||
expect(cache.get('2')).to.be.equal('not-super-setting'); | ||
}); | ||
|
||
it('should not update the setting if the new value is undefined', async () => { | ||
await rawModule.updateValue('2', {}); | ||
|
||
expect(cache.get('2')).to.be.equal('not-super-setting'); | ||
}); | ||
}); |
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
Oops, something went wrong.