Browse Source

[+Elena,+Jordi] Acceptance test for signing petition

Elisa Cutrin 1 year ago
parent
commit
13dae3c7b2
1 changed files with 44 additions and 0 deletions
  1. 44 0
      apps/wallet/test/acceptance/sign.test.js

+ 44 - 0
apps/wallet/test/acceptance/sign.test.js

@@ -83,6 +83,50 @@ describe('signing a petition', () => {
83 83
     // THEN I am not able to sign
84 84
     expect(wrapper.dive().find(Button).first().prop('enabled')).toEqual(false);
85 85
   });
86
+
87
+
88
+  it('should allow me to sign if I have required attributes', () => {
89
+    const state = {
90
+      ...initialState,
91
+      // GIVEN a petition with X attributes
92
+      petition: {
93
+        petition: {
94
+          title: 'hello',
95
+          description: 'world',
96
+          closingDate: 'today',
97
+          id: '1234',
98
+          isEthereum: 'false',
99
+        },
100
+      },
101
+      attributes: {
102
+        isRequiredAttributeEnabled: true,
103
+        optionalAttributesToggleStatus: {
104
+          age: false,
105
+          gender: false,
106
+        },
107
+        // AND I do not have a required attribute
108
+        list: [
109
+          {
110
+            scope: '',
111
+            provenance: '',
112
+            subject: '',
113
+            object: '',
114
+          },
115
+        ],
116
+      },
117
+    };
118
+
119
+    store = mockStore(state);
120
+
121
+    // WHEN I review the petition
122
+    const wrapper = shallow(
123
+      <PetitionSummary />,
124
+      { context: { store } },
125
+    );
126
+
127
+    // THEN I am able to sign
128
+    expect(wrapper.dive().find(Button).first().prop('enabled')).toEqual(true);
129
+  });
86 130
 });
87 131
 
88 132
 // NEXT ITERATIONS OF THE TEST: