小编Vad*_*tov的帖子

摩卡测试“0通过”

我正在尝试为我的反应应用程序编写一些测试。

当测试正确时,我会在控制台中得到这个。

0 passing (0ms)
Run Code Online (Sandbox Code Playgroud)

测试文件appTest.test.js

var expect = require('chai').expect
    , foo = 'bar'
    , beverages = { tea: [ 'chai', 'matcha', 'oolong' ] };

expect(foo).to.be.a('string');
expect(foo).to.equal('bar');
expect(foo).to.have.lengthOf(3);
expect(beverages).to.have.property('tea').with.lengthOf(3);
Run Code Online (Sandbox Code Playgroud)

包.json

"test": "NODE_ENV=test mocha --require @babel/register --require ./test/*.test.js   --watch",
Run Code Online (Sandbox Code Playgroud)

目录

有趣的是,如果我给出了错误的期望,它就会失败,因此它会收到文件

testing mocha.js node.js chai reactjs

3
推荐指数
1
解决办法
3939
查看次数

Spring - 无法解析 MVC“查看”百里香叶

我得到了一个简单的HomeController.class

package com.example.tacos;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
public class HomeController {

    @GetMapping("/")
    public String home() {
        return "home";
    }
}
Run Code Online (Sandbox Code Playgroud)

我也有一个模板叫做 home.html

<!DOCTYPE HTML>
    <head>
    <title>Getting Started: Serving Web Content</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>
    <body>
        <p>Hey</p>
    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

无论如何,我在浏览器中得到 404,IDE 告诉我无法解析 MVC“视图”,正如您在屏幕上看到的那样

文件夹结构: 文件夹结构

浏览器: 浏览器

spring spring-mvc thymeleaf spring-boot

3
推荐指数
2
解决办法
5818
查看次数