-
Notifications
You must be signed in to change notification settings - Fork 501
/
Copy pathEditKeyRequest-test.js
38 lines (32 loc) · 1.37 KB
/
EditKeyRequest-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from "react"
import { shallow, render, mount } from "enzyme"
import { expect } from "chai"
import EditKeyRequest from "./../../../../../src/js/components/ObjectKeyModal/EditKeyRequest"
import ObjectAttributes from "./../../../../../src/js/stores/ObjectAttributes"
describe("<EditKeyRequest />", function() {
const rjvId = 1
it("EditKeyRequest should not render input when inactive", function() {
ObjectAttributes.set(rjvId, "action", "new-key-request", {
existing_value: { test: true },
namespace: [],
new_value: { test: null }
})
ObjectAttributes.set(rjvId, "global", "src", { test: true })
const wrapper = mount(
<EditKeyRequest active={false} theme="rjv-default" rjvId={rjvId} />
)
expect(wrapper.find(".key-modal-input").length).to.equal(0)
})
it("EditKeyRequest should render input when active", function() {
ObjectAttributes.set(rjvId, "action", "new-key-request", {
existing_value: { test: true },
namespace: [],
new_value: { test: null }
})
ObjectAttributes.set(rjvId, "global", "src", { test: true })
const wrapper = mount(
<EditKeyRequest active={true} theme="rjv-default" rjvId={rjvId} />
)
expect(wrapper.find(".key-modal-input").length).to.equal(1)
})
})