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
function Animal() { | |
} | |
Animal.prototype.nascer = function() { | |
// ... | |
} | |
Animal.prototype.morrer = function() { | |
// ... | |
} | |
Animal.prototype.respirar = function() { | |
// ... |
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
files = ['a.txt', 'j.txt']; | |
ret = ""; | |
function concatFiles(file, ret){ | |
shifted = file.shift(); | |
if(!shifted){ | |
console.log(ret); | |
return; | |
} |
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
### Keybase proof | |
I hereby claim: | |
* I am mkdarkness on github. | |
* I am mkdarkness (https://keybase.io/mkdarkness) on keybase. | |
* I have a public key whose fingerprint is 0E46 BB8E 44A1 8CF8 BB96 5F87 9CB0 9362 58FF 7528 | |
To claim this, I am signing this object: |
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
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
//loading required Schemas | |
var departamentsSchema = mongoose.model('departments').schema;//require('./departaments'); | |
var badgesSchema = mongoose.model('badges').schema; //require('./badges'); | |
var permissionsSchema = mongoose.model('badges').schema;//require('./permissions'); | |
//user schema |
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
var request = require('request'); | |
var assert = require('assert'); | |
describe('API / USER Test', function(){ | |
//test get list | |
describe('GET /api/users', function(){ | |
it('code 200 && array', function(done){ | |
request('http://localhost:8080/api/users', function(err, res){ | |
assert.equal(res.statusCode, 200); | |
assert.ok(typeof JSON.parse(res.body) === "object"); |
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
var express = require('express'); | |
var domain = require('domain'); | |
var app = express(); | |
app.use(function(req, res, next){ | |
var d = domain.create(); | |
d.add(req); | |
d.add(req); |
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
describe('DELETE /api/user', function () { | |
it('Delete User Sucess', function (done) { | |
request('http://localhost:8080/api/') | |
.del('user/53b48b72f4211ee61908efac') | |
.expect(202, done); | |
}); | |
}); |
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
describe('DELETE /api/user', function () { | |
it('Delete User Sucess', function (done) { | |
request('http://localhost:8080/api/') | |
.del('user/53b48b72f4211ee61908efac') | |
.expect(202, done); | |
}); | |
}); |
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
describe('GET /api/users', function(){ | |
it('recovery users list', function(done){ | |
request('http://localhost:8080/api/') | |
.get('users') | |
.set('Content-Type', 'application/json') | |
.expect('Content-Type', /json/) | |
.expect(function(res){ | |
if(('error' in res.body)) return "Error here!"; | |
}) | |
.expect(200, done); |
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
//Usaremos o describe para ser a nossa suite do POST no verbo "user" da nossa API | |
describe('POST /api/user', function () { | |
//Usaremos o It para dizer o que iremos testar dentro dessa suite. | |
it('Create User Sucess', function (done) { | |
// criando um objeto com os campos de usuário para testar uma inserção. | |
var user = { | |
"email": "marcos@thedon.com.br", | |
"name":{ | |
"first": "Marcos", | |
"last": "Bérgamo" |
OlderNewer