随笔分类 -  Unit Testing

上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要:const { TestScheduler } = require("rxjs/testing"); const { map, take, delay, mapTo, catchError } = require("rxjs/operators"); const { concat, from, of 阅读全文
posted @ 2022-10-14 19:35 Zhentiw 阅读(22) 评论(0) 推荐(0) 编辑
摘要:const { TestScheduler } = require("rxjs/testing"); const { map, take, delay } = require("rxjs/operators"); const { concat, from } = require("rxjs"); d 阅读全文
posted @ 2022-10-13 20:39 Zhentiw 阅读(15) 评论(0) 推荐(0) 编辑
摘要:const { TestScheduler } = require("rxjs/testing"); const { map, take } = require("rxjs/operators"); const { concat, from } = require("rxjs"); describe 阅读全文
posted @ 2022-10-13 20:31 Zhentiw 阅读(17) 评论(0) 推荐(0) 编辑
摘要:const { TestScheduler } = require("rxjs/testing"); const { map, take } = require("rxjs/operators"); const { concat } = require("rxjs"); describe("Marb 阅读全文
posted @ 2022-10-13 20:24 Zhentiw 阅读(14) 评论(0) 推荐(0) 编辑
摘要:const { TestScheduler } = require("rxjs/testing"); const { map } = require("rxjs/operators"); const { concat } = require("rxjs"); describe("Marble tes 阅读全文
posted @ 2022-10-13 20:09 Zhentiw 阅读(16) 评论(0) 推荐(0) 编辑
摘要:CrudController: 查看代码 export const getOne = model => async (req, res) => { try { const doc = model .findOne({ createdBy: req.user._id, _id: req.params. 阅读全文
posted @ 2022-08-23 19:25 Zhentiw 阅读(21) 评论(0) 推荐(0) 编辑
摘要:Model: import mongoose from 'mongoose' const itemSchema = new mongoose.Schema( { name: { type: String, required: true, trim: true, maxlength: 50 }, st 阅读全文
posted @ 2022-08-23 19:20 Zhentiw 阅读(13) 评论(0) 推荐(0) 编辑
摘要:Model: import mongoose from 'mongoose' const itemSchema = new mongoose.Schema( { name: { type: String, required: true, trim: true, maxlength: 50 }, st 阅读全文
posted @ 2022-08-22 21:00 Zhentiw 阅读(15) 评论(0) 推荐(0) 编辑
摘要:server.js: import itemRouter from './resources/item/item.router' export const app = express() app.use('/api/item', itemRouter) item.router.js import { 阅读全文
posted @ 2022-08-22 19:14 Zhentiw 阅读(13) 评论(0) 推荐(0) 编辑
摘要:Assumption: Run the testing code only if when the condition is match, otherwise, test will be ignored @Test void runTestIf() { System.out.print("Curre 阅读全文
posted @ 2022-08-04 18:28 Zhentiw 阅读(23) 评论(0) 推荐(0) 编辑
摘要:Let’s add a test for an edge case that responds with an error message. In this lesson we’ll talk about the value of using the toMatchInlineSnapshot as 阅读全文
posted @ 2021-08-16 14:45 Zhentiw 阅读(62) 评论(0) 推荐(0) 编辑
摘要:You can have a untils folder under root folder, to let jest include your files, you can do: const path = require('path') module.exports = { displayNam 阅读全文
posted @ 2021-08-09 15:42 Zhentiw 阅读(38) 评论(0) 推荐(0) 编辑
摘要:Code: import {UnauthorizedError} from 'express-jwt' function errorMiddleware(error, req, res, next) { if (res.headersSent) { next(error) } else if (er 阅读全文
posted @ 2021-08-05 20:58 Zhentiw 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Jest has a test-generation feature built-in called test.each which is great, but I don’t particularly like it’s API. Instead, we’re going to use an op 阅读全文
posted @ 2021-08-05 18:51 Zhentiw 阅读(43) 评论(0) 推荐(0) 编辑
摘要:One of the most crucial things you can do when writing tests is ensuring that the error message explains the problem as clearly as possible so it can 阅读全文
posted @ 2021-08-05 18:41 Zhentiw 阅读(31) 评论(0) 推荐(0) 编辑
摘要:In Postman, you can create a collection of API requests. Those collection can be save into json file as well. { "info": { "_postman_id": "9c5a8003-1c5 阅读全文
posted @ 2021-03-20 17:24 Zhentiw 阅读(46) 评论(0) 推荐(0) 编辑
摘要:Testing JWT proteceted endpoint: /** * HTTP POST /tours/{tourId}/ratings */ @Test public void createTourRating() throws Exception { restTemplate.excha 阅读全文
posted @ 2020-12-27 22:09 Zhentiw 阅读(209) 评论(0) 推荐(0) 编辑
摘要:Controller: @RestController @RequestMapping(path = "/ratings") public class RatingController { private static final Logger LOGGER = LoggerFactory.getL 阅读全文
posted @ 2020-12-26 04:33 Zhentiw 阅读(135) 评论(0) 推荐(0) 编辑
摘要:Service: package com.example.ec.service; import com.example.ec.domain.Tour; import com.example.ec.domain.TourRating; import com.example.ec.repo.TourRa 阅读全文
posted @ 2020-12-23 03:40 Zhentiw 阅读(469) 评论(0) 推荐(0) 编辑
摘要:Controller: @Controller @RequestMapping("/reservations") public class RoomReservationWebController { @Autowired private ReservationService reservation 阅读全文
posted @ 2020-11-29 02:41 Zhentiw 阅读(128) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 10 下一页
点击右上角即可分享
微信分享提示