tests ES6 refactoring, tests update, + common.js tests
This commit is contained in:
1 parent
ae11dc5235
commit
766105afac
6 files changed
+58
-43
No files matched your search
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "src/bin/www.js",
|
"main": "src/bin/www.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha",
|
"test": "mocha --compilers js:babel-register",
|
||||||
"bower": "bower"
|
"bower": "bower"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* Created by tmshv on 13/03/15.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var co = require("co");
|
|
||||||
var should = require("should");
|
|
||||||
var instagram = require("../instagram/instagram");
|
|
||||||
var db = require("../core/db");
|
|
||||||
var config = require("../config");
|
|
||||||
|
|
||||||
describe("Instagram", function () {
|
|
||||||
describe("getUser()", function () {
|
|
||||||
it("should return default user if exists", function () {
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
--recursive
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* Created by tmshv on 08/03/15.
|
|
||||||
*/
|
|
||||||
|
|
||||||
var should = require("should");
|
|
||||||
|
|
||||||
describe("utils", function () {
|
|
||||||
describe("net.js", function () {
|
|
||||||
describe("query", function () {
|
|
||||||
var query = require("../utils/net").query;
|
|
||||||
var sample = [["count", 10], ["portion", 5], ["hello", "lol"]];
|
|
||||||
|
|
||||||
it("should combine query params", function () {
|
|
||||||
var params = query(sample);
|
|
||||||
params.should.be.equal("count=10&portion=5&hello=lol");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should return string", function () {
|
|
||||||
var params = query(sample);
|
|
||||||
|
|
||||||
params.should.be.type("string");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import should from 'should';
|
||||||
|
import {translateAnItem} from '../../src/utils/common';
|
||||||
|
|
||||||
|
describe('utils', () => {
|
||||||
|
describe('common.js', () => {
|
||||||
|
describe('translateAnItem', () => {
|
||||||
|
let sample = [[1235, 'hello'], [2352, 'banana']];
|
||||||
|
|
||||||
|
it('should return a function', () => {
|
||||||
|
let fn = translateAnItem();
|
||||||
|
fn.should.be.type('function');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should accept a function as a first parameter and use it as byCondition', () => {
|
||||||
|
let fn = translateAnItem(
|
||||||
|
i => i[0] === 2352 && i[1] === 'banana' && i.length === 2,
|
||||||
|
i => i[1]
|
||||||
|
);
|
||||||
|
|
||||||
|
let result = sample.reduce(fn);
|
||||||
|
result.should.be.equal('banana');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should accept a function as a second parameter and use it as mapping function', () => {
|
||||||
|
let fn = translateAnItem(
|
||||||
|
i => i[0] === 2352,
|
||||||
|
i => i[1]
|
||||||
|
);
|
||||||
|
|
||||||
|
let result = sample.reduce(fn);
|
||||||
|
result.should.be.equal('banana');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import should from 'should';
|
||||||
|
import {query} from '../../src/utils/net';
|
||||||
|
|
||||||
|
describe('utils', () => {
|
||||||
|
describe('net.js', () => {
|
||||||
|
describe('query', () => {
|
||||||
|
let sample = [['count', 10], ['portion', 5], ['hello', 'lol']];
|
||||||
|
|
||||||
|
it('should combine query params', () => {
|
||||||
|
let params = query(sample);
|
||||||
|
params.should.be.equal('count=10&portion=5&hello=lol');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return string', () => {
|
||||||
|
let params = query(sample);
|
||||||
|
|
||||||
|
params.should.be.type('string');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in new issue
Block a user