谁能建议如何在ava中编写测试用例

时间:2019-07-17 12:39:27

标签: ava

我的测试用例开玩笑地返回。现在,我必须使用Ava运行此测试用例,因此,建议我如何更改此代码

describe("Validate a new User", () => {

    it("should return an empty Error Object when validation succeeds", () => {
        const User = {
            user_full_name: "aaa",
            user_email: "aaa@gmail.com",
            user_password: "Aaaa",
            user_phone: "1234567895"
        };
        let result = UserModel.validateNewUser(User);
        expect(result.error).toBeNull();
    });

    it("should return an Error Object when validation fails", () => {
        const User = {
            user_full_name: "abcd",
            user_email: "abcdxyzcom",
            user_password: "abcd$123",
            user_phone: "1234567891"
        };
        let result = UserModel.validateNewUser(User);
        expect(result.error.name).toEqual('ValidationError');
    });


});

0 个答案:

没有答案