-
Notifications
You must be signed in to change notification settings - Fork 0
/
tester.js
67 lines (63 loc) · 1.78 KB
/
tester.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
59
60
61
62
63
64
65
66
67
const { User, Project, Container } = require("./models/user-model");
async function run() {
const sampleSuccess = {
data: {
project: {
repoNameWithOwner: "TnSor06/TestRepo4",
repoURL: "https://github.com/TnSor06/TestRepo4",
repoID: 251391890
},
container1: { image: "python", tag: "3.5" },
container2: { image: "mongo" }
},
message: "Build",
image: {
imageName: "tnsor06-testrepo4-node-12",
imageId: "ae93b1547e92",
container: "container1"
}
};
const sampleReject = {
data: {
project: {
repoNameWithOwner: "TnSor06/TestRepo1",
repoURL: "https://github.com/TnSor06/TestRepo1",
repoID: 251390607
},
container1: { image: "python", tag: "3.5" },
container2: { image: "mongo" }
},
message: "Error on build"
};
console.log(sampleReject.data.project.repoID, sampleReject.message);
var query = Project.find({});
const projects = await Project.find(
{ repoID: sampleReject.data.project.repoID },
(error, user) => {
if (error) {
return { error: error, user: null };
} else if (user) {
return { user, error: null };
}
}
);
return projects;
// const updateRejectProject = await Project.findOne(
// { repoID: sampleReject.data.project.repoID },
// async function(err, doc) {
// if (err) {
// console.log("ran into error");
// }
// console.log(doc);
// // doc.status = sampleReject.message;
// // const data = await doc.save(async function(err, data) {
// // console.log(err, data);
// // });
// }
// );
// console.log(updateRejectProject);
}
async function runner() {
const returnData = await run();
}
runner();