-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaker.js
58 lines (54 loc) · 2.26 KB
/
faker.js
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
54
55
56
57
58
console.info(`
_ __ _ _
(_) / _| | | | |
_____ ________ _ ___ ______| |_ __ _| | _____ _ __ ______ _ __ ___ __ _ _ _ ___ ___| |_
/ _ \\ \\/ /______| / __|______| _/ _\` | |/ / _ \\ '__|______| '__/ _ \\/ _\` | | | |/ _ \\/ __| __|
| __/> < | \\__ \\ | || (_| | < __/ | | | | __/ (_| | |_| | __/\\__ \\ |_
\\___/_/\\_\\ | |___/ |_| \\__,_|_|\\_\\___|_| |_| \\___|\\__, |\\__,_|\\___||___/\\__|
_/ | | |
|__/ |_|
v1.0.0 (c) leganux.net 2007-2023
`)
module.exports = {
/** Función para crear objeto de request falso */
fakeRequestFunction: function (originalReq) {
this.body = originalReq.body
this.user = originalReq.user
this.params = originalReq.params
this.query = originalReq.query
this.headers = originalReq.headers
this.cookies = originalReq.cookies
},
/** Creamos el objeto de la funcion de retorno falsa **/
fakeResponseFunction: function () {
this.status_ = 200;
this.json_ = {};
this.json = function (resp) {
this.json_ = resp
return this
};
this.status = function (number) {
this.status_ = number;
return this
};
this.send = function (text) {
this.json_ = {text};
return this
};
this.sendFile = function (filePath) {
this.json_ = {filePath};
return this
};
/** todo render pug to html*/
this.render = function (filePath) {
this.json_ = {filePath};
return this
};
this.get = function () {
return {
status: this.status_,
json: this.json_
}
}
}
}