-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathhandler.test.js
More file actions
53 lines (45 loc) · 1.04 KB
/
Copy pathhandler.test.js
File metadata and controls
53 lines (45 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
require('dotenv').load();
var hello = require('./handler').hello
var saveTaco = require('./handler').saveTaco
var TestUtils = require('./TestUtils.util');
var assert = require('chai').assert;
var should = require('chai').should();
describe("Taco Gallery tests", function () {
before(function(done){
this.timeout(50000);
TestUtils.mockDB().then(function(data){
done();
})
.catch(function(err){
assert(false,"Could not create the mock DB")
done();
});
});
it('the hello function should work', function(done){
this.timeout(50000);
var event={};
var context={};
var callback = (ctx, data) => {
done();
}
hello(event,context,callback)
})
it('should save a taco', function(done){
var event={
"body":'{"name":"Al pastor","description": "Delicious taco!"}'
};
var context={};
var callback = (ctx, data) => {
try{
console.log(data)
assert(data);
assert(data.statusCode == 200);
}
catch (err){
console.log(err)
done(err);
}
}
saveTaco(event,context,callback)
})
});