박시진

[Add]Test file (check login_success&info)

...@@ -161,15 +161,5 @@ exports.getSubjects = getSubjects; ...@@ -161,15 +161,5 @@ exports.getSubjects = getSubjects;
161 exports.close = close; 161 exports.close = close;
162 162
163 163
164 -//console test 164 +
165 -async function runrun() {
166 - page = await login("2021105253", "lorem");
167 - await getPeed(page);
168 - await getSubjects(page);
169 - await close();
170 - console.log(Info);
171 - console.log(Info.subjects)
172 -
173 -}
174 -runrun();
175 165
......
1 +const express = require("express");
2 +const router = express.Router();
3 +
4 +const { getPeed, getSubjects, login, close } = require("./E_Campus.js");
5 +
6 +async function runrun() {
7 + page = await login("lorem", "lorem");
8 + await getPeed(page);
9 + await getSubjects(page);
10 + await close();
11 + console.log(Info);
12 + console.log(Info.subjects)
13 +
14 + }
15 + runrun();
16 +
...\ No newline at end of file ...\ No newline at end of file
1 const express = require("express"); 1 const express = require("express");
2 const router = express.Router(); 2 const router = express.Router();
3 3
4 -// const { getPeed, getSubjects, login } = require("../libs/E_Campus.js"); 4 +const { getPeed, getSubjects, login, close } = require("../libs/E_Campus.js");
5 -const { login } = require("../libs/E_Campus.js"); 5 +
6 router.post("/", async (req, res) => { 6 router.post("/", async (req, res) => {
7 console.log(`listened /login ${req.body.id} ${req.body.pw}`); 7 console.log(`listened /login ${req.body.id} ${req.body.pw}`);
8 - const Info = await login(req.body.id, req.body.pw); 8 + const page = await login(req.body.id, req.body.pw);
9 - if (Info.id != "null") { 9 + if (page) {
10 try { 10 try {
11 - // const peed = await getPeed(page);
12 res.send("success"); 11 res.send("success");
13 } catch (e) { 12 } catch (e) {
14 console.log(e); 13 console.log(e);
......