我正在通过酶创建一个单元测试用例。在“ register.js”文件中,我在用户对象中设置了表单状态,但是在“ register-test.js”文件中,该状态的值被赋予了“ undefined”:-
Dim SQLCONN As New Npgsql.NpgsqlConnection
Dim SQLCMD As New Npgsql.NpgsqlCommand
SQLCONN.ConnectionString =
"SERVER=localhost;PORT=5432;DATABASE=xxxx;Uid=postgres;Password=xxxx"
SQLCMD.Connection = SQLCONN
SQLCMD.CommandType = CommandType.StoredProcedure
SQLCMD.CommandText = "spx_temp_to_ext"
SQLCONN.Open()
SQLCMD.ExecuteNonQuery()
SQLCONN.Close()
在register.js文件中设置了用户对象状态
Expected: "dinesh"
Received: undefined
我正在尝试“ register-test.js”。
this.state = {
user: {
firstName: ''
},
答案 0 :(得分:0)
wrapper.find('input[type="text"]').simulate('change', {target: {name: 'firstName', value: 'dinesh'}});
expect(wrapper.state().user.firstName).toEqual('dinesh');
您的名字在用户名下