-
Notifications
You must be signed in to change notification settings - Fork 2
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 #8 from tprzytula/development
Refactored client/server unit tests & coverage
- Loading branch information
Showing
25 changed files
with
856 additions
and
759 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.idea | ||
.coverage | ||
node_modules/ | ||
npm-debug.log |
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 |
---|---|---|
|
@@ -7,16 +7,17 @@ | |
[email protected] # Packages every Meteor app needs to have | ||
[email protected] # Packages for a great mobile UX | ||
[email protected] # The database Meteor supports right now | ||
[email protected] # Compile .html files into Meteor Blaze views | ||
[email protected] # Reactive variable for tracker | ||
[email protected] # Compile .html files into Meteor Blaze views | ||
[email protected] # Reactive variable for tracker | ||
[email protected] # Meteor's client-side reactive programming library | ||
|
||
[email protected] # CSS minifier run for production mode | ||
[email protected] # JS minifier run for production mode | ||
[email protected] # ECMAScript 5 compatibility for older browsers | ||
[email protected] # Enable ECMAScript2015+ syntax in app code | ||
[email protected] # Enable ECMAScript2015+ syntax in app code | ||
[email protected] # Server-side component of the `meteor shell` command | ||
|
||
tprzytula:remember-me | ||
accounts-base | ||
meteortesting:mocha | ||
lmieulet:meteor-coverage |
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,2 @@ | ||
package.js | ||
package.js | ||
.coverage |
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 |
---|---|---|
|
@@ -17,3 +17,4 @@ appveyor.yml | |
.travis.yml | ||
node_modules | ||
npm-debug.log | ||
.coverage |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,121 @@ | ||
const { exportFlagFromParams, exportCallbackFromParams } = require('./../../client/helpers'); | ||
const chai = require('ultimate-chai'); | ||
|
||
const { expect } = chai; | ||
|
||
describe('Given exportFlagFromParams', () => { | ||
const sampleFlag = false; | ||
const sampleMethod = () => {}; | ||
let result; | ||
|
||
describe('When rememberMe flag is a first param', () => { | ||
beforeEach(() => { | ||
result = exportFlagFromParams([sampleFlag]); | ||
}); | ||
|
||
it('should return the flag', () => { | ||
expect(result).to.be.equal(sampleFlag); | ||
}); | ||
}); | ||
|
||
describe('When rememberMe flag is a second param', () => { | ||
beforeEach(() => { | ||
result = exportFlagFromParams([sampleMethod, sampleFlag]); | ||
}); | ||
|
||
it('should return the flag', () => { | ||
expect(result).to.be.equal(sampleFlag); | ||
}); | ||
}); | ||
|
||
describe('When parameters are only containing a method', () => { | ||
beforeEach(() => { | ||
result = exportFlagFromParams([sampleMethod]); | ||
}); | ||
|
||
it('should return true as default', () => { | ||
expect(result).to.be.equal(true); | ||
}); | ||
}); | ||
|
||
describe('When the parameters are empty', () => { | ||
beforeEach(() => { | ||
result = exportFlagFromParams([]); | ||
}); | ||
|
||
it('should return true as default', () => { | ||
expect(result).to.be.equal(true); | ||
}); | ||
}); | ||
|
||
describe('When nothing is passed to the method', () => { | ||
beforeEach(() => { | ||
result = exportFlagFromParams(); | ||
}); | ||
|
||
it('should return true as default', () => { | ||
expect(result).to.be.equal(true); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Given exportCallbackFromParams', () => { | ||
const sampleMethod = () => {}; | ||
let result; | ||
|
||
describe('When function is a first param', () => { | ||
beforeEach(() => { | ||
result = exportCallbackFromParams([sampleMethod, 1, 'abc']); | ||
}); | ||
|
||
it('should return the same method', () => { | ||
expect(result).to.be.equal(sampleMethod); | ||
}); | ||
}); | ||
|
||
describe('When function is a second param', () => { | ||
beforeEach(() => { | ||
result = exportCallbackFromParams([1, sampleMethod, 'abc']); | ||
}); | ||
|
||
it('should return a function', () => { | ||
expect(typeof result).to.be.equal('function'); | ||
}); | ||
|
||
describe('And the returned function', () => { | ||
it('should not be the same as the one in params', () => { | ||
expect(result).to.not.be.equal(sampleMethod); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('When function is not in parameters', () => { | ||
beforeEach(() => { | ||
result = exportCallbackFromParams([1, 'abc']); | ||
}); | ||
|
||
it('should return a function', () => { | ||
expect(typeof result).to.be.equal('function'); | ||
}); | ||
}); | ||
|
||
describe('When the parameters are empty', () => { | ||
beforeEach(() => { | ||
result = exportCallbackFromParams([]); | ||
}); | ||
|
||
it('should return a function', () => { | ||
expect(typeof result).to.be.equal('function'); | ||
}); | ||
}); | ||
|
||
describe('When nothing is passed to the method', () => { | ||
beforeEach(() => { | ||
result = exportCallbackFromParams(); | ||
}); | ||
|
||
it('should return a function', () => { | ||
expect(typeof result).to.be.equal('function'); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.