Advertisement
Guest User

Untitled

a guest
Nov 25th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.92 KB | None | 0 0
  1. const request = require("supertest");
  2. const app = require("../app");
  3.  
  4. describe("Customer", function() {
  5. let data = {
  6. username: "test35",
  7. password: "Aa123456",
  8. firstname: "Alexander",
  9. lastname: "Zero",
  10. birthdate: "01",
  11. birthmonth: "12",
  12. birthyear: "2000",
  13. address: "London",
  14. phone: "0888888888",
  15. email: "e@mail.com"
  16. };
  17. it("update customer profile", function(done) {
  18. request(app)
  19. .post("/api/customer/updateProfile")
  20. .send(data)
  21. .set("Accept", "application/json")
  22. .expect(200, done);
  23. });
  24. data = {
  25. username: "test35"
  26. };
  27. it("verify customer identity", function(done) {
  28. request(app)
  29. .post("/api/customer/verifyIdentity")
  30. .send(data)
  31. .set("Accept", "application/json")
  32. .expect(200, done);
  33. });
  34. it("customer detail", function(done) {
  35. request(app)
  36. .post("/api/customer/detail")
  37. .send(data)
  38. .set("Accept", "application/json")
  39. .expect(200, done);
  40. });
  41. it("customer rating", function(done) {
  42. request(app)
  43. .post("/api/customer/review")
  44. .send(data)
  45. .set("Accept", "application/json")
  46. .expect(200, done);
  47. });
  48. data = {
  49. username: "test35",
  50. password: "Aa123456"
  51. };
  52. it("customer login", function(done) {
  53. request(app)
  54. .post("/api/customer/login")
  55. .send(data)
  56. .set("Accept", "application/json")
  57. .expect(200, done);
  58. });
  59. data = {
  60. username: "test35",
  61. password: "Aa123456",
  62. firstname: "Alexander",
  63. lastname: "Zero",
  64. birthdate: "01",
  65. birthmonth: "12",
  66. birthyear: "2000",
  67. address: "London",
  68. phone: "0888888888",
  69. email: "e@mail.com"
  70. };
  71. it("customer signup", function(done) {
  72. request(app)
  73. .post("/api/customer/signup")
  74. .send(data)
  75. .set("Accept", "application/json")
  76. .expect(200, done);
  77. });
  78. });
  79. describe("Driver", function() {
  80. let data = {
  81. username: "driver5",
  82. password: "12345678",
  83. firstname: "Alexander",
  84. lastname: "Zero",
  85. birthdate: "01",
  86. birthmonth: "12",
  87. birthyear: "2000",
  88. address: "London",
  89. phone: "0888888888",
  90. email: "e@mail.com"
  91. };
  92. it("update driver profile", function(done) {
  93. request(app)
  94. .post("/api/driver/updateProfile")
  95. .send(data)
  96. .set("Accept", "application/json")
  97. .expect(200, done);
  98. });
  99. data = {
  100. username: "driver5"
  101. };
  102. it("verify driver identity", function(done) {
  103. request(app)
  104. .post("/api/driver/verifyIdentity")
  105. .send(data)
  106. .set("Accept", "application/json")
  107. .expect(200, done);
  108. });
  109. it("driver detail", function(done) {
  110. request(app)
  111. .post("/api/driver/detail")
  112. .send(data)
  113. .set("Accept", "application/json")
  114. .expect(200, done);
  115. });
  116. it("driver rating", function(done) {
  117. request(app)
  118. .post("/api/driver/review")
  119. .send(data)
  120. .set("Accept", "application/json")
  121. .expect(200, done);
  122. });
  123. data = {
  124. username: "driver5",
  125. password: "12345678"
  126. };
  127. it("driver login", function(done) {
  128. request(app)
  129. .post("/api/driver/login")
  130. .send(data)
  131. .set("Accept", "application/json")
  132. .expect(200, done);
  133. });
  134. data = {
  135. username: "driver5",
  136. password: "12345678",
  137. firstname: "Alexander",
  138. lastname: "Zero",
  139. birthdate: "01",
  140. birthmonth: "12",
  141. birthyear: "2000",
  142. address: "London",
  143. phone: "0888888888",
  144. email: "e@mail.com"
  145. };
  146. it("driver signup", function(done) {
  147. request(app)
  148. .post("/api/driver/signup")
  149. .send(data)
  150. .set("Accept", "application/json")
  151. .expect(200, done);
  152. });
  153. });
  154. describe("Offers", function() {
  155. let data = {
  156. price: "50",
  157. starting_point: "Bangkok",
  158. destination: "London",
  159. start_date: "2018-11-01 00:00:00",
  160. end_date: "2018-11-05 00:00:00",
  161. car_brand: "BMW",
  162. car_model: "Z4",
  163. car_capacity: "5",
  164. addition_rule: "",
  165. driver_username: "Driver5"
  166. };
  167. it("add offer", function(done) {
  168. request(app)
  169. .post("/api/offers/addoffer")
  170. .send(data)
  171. .set("Accept", "application/json")
  172. .expect(200, done);
  173. });
  174. it("search offer", function(done) {
  175. request(app)
  176. .post("/api/offers/search")
  177. .send(data)
  178. .set("Accept", "application/json")
  179. .expect(200, done);
  180. });
  181. it("view offer", function(done) {
  182. request(app)
  183. .get("/api/offers/:offer_id")
  184. .set("Accept", "application/json")
  185. .expect("Content-Type", /json/)
  186. .expect(200, done);
  187. });
  188. data = {
  189. offer_id: "1"
  190. };
  191. it("delete offer", function(done) {
  192. request(app)
  193. .delete("/api/offers/:offer_id")
  194. .send(data)
  195. .set("Accept", "application/json")
  196. .expect("Content-Type", /json/)
  197. .expect(200, done);
  198. });
  199. it("my offer", function(done) {
  200. request(app)
  201. .get("/api/offers/myoffers")
  202. .set("Accept", "application/json")
  203. .expect("Content-Type", /json/)
  204. .expect(200, done);
  205. });
  206. });
  207. describe("Service", function() {
  208. let data = {
  209. service_id: "22",
  210. driver_username: "driver2"
  211. };
  212. it("confirm as driver", function(done) {
  213. request(app)
  214. .post("/api/service/confirmasdriver")
  215. .send(data)
  216. .set("Accept", "application/json")
  217. .expect(200, done);
  218. });
  219. });
  220. /*describe("Offers", function() {
  221. let data = {
  222. price: "50",
  223. starting_point: "Bangkok",
  224. destination: "London",
  225. start_date: "2018-11-01 00:00:00",
  226. end_date: "2018-11-05 00:00:00",
  227. car_brand: "BMW",
  228. car_model: "Z4",
  229. car_capacity: "5",
  230. addition_rule: "",
  231. driver_username: "Driver5"
  232. };
  233. it("add offer", function(done) {
  234. request(app)
  235. .post("/api/offers/addoffer")
  236. .send(data)
  237. .set("Accept", "application/json")
  238. .expect(200, done);
  239. });
  240. });
  241.  
  242. describe("Offers", function() {
  243. let data = {
  244. price: "50",
  245. starting_point: "Bangkok",
  246. destination: "London",
  247. start_date: "2018-11-01 00:00:00",
  248. end_date: "2018-11-05 00:00:00",
  249. car_brand: "BMW",
  250. car_model: "Z4",
  251. car_capacity: "5",
  252. addition_rule: "",
  253. driver_username: "Driver5"
  254. };
  255. it("add offer", function(done) {
  256. request(app)
  257. .post("/api/offers/addoffer")
  258. .send(data)
  259. .set("Accept", "application/json")
  260. .expect(200, done);
  261. });
  262. });
  263. describe("Offers", function() {
  264. let data = {
  265. price: "50",
  266. starting_point: "Bangkok",
  267. destination: "London",
  268. start_date: "2018-11-01 00:00:00",
  269. end_date: "2018-11-05 00:00:00",
  270. car_brand: "BMW",
  271. car_model: "Z4",
  272. car_capacity: "5",
  273. addition_rule: "",
  274. driver_username: "Driver5"
  275. };
  276. it("add offer", function(done) {
  277. request(app)
  278. .post("/api/offers/addoffer")
  279. .send(data)
  280. .set("Accept", "application/json")
  281. .expect(200, done);
  282. });
  283. });*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement