Skip to content

Commit bbda844

Browse files
committed
Reverts writted tests
1 parent dbc2a81 commit bbda844

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

contentcuration/contentcuration/frontend/channelEdit/vuex/contentNode/getters.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,15 @@ export function getContentNodeIsValid(state, getters, rootState, rootGetters) {
159159
export function getContentNodeDetailsAreValid(state) {
160160
return function (contentNodeId) {
161161
const contentNode = state.contentNodesMap[contentNodeId];
162-
return contentNode && (contentNode[NEW_OBJECT] || !getNodeDetailsErrors(contentNode).length);
162+
const errorList = getNodeDetailsErrorsList(state)(contentNodeId);
163+
return contentNode?.[NEW_OBJECT] || !errorList.length;
163164
};
164165
}
165166

166167
export function getNodeDetailsErrorsList(state) {
167168
return function (contentNodeId) {
168169
const contentNode = state.contentNodesMap[contentNodeId];
169-
return contentNode ? getNodeDetailsErrors(contentNode) : [];
170+
return getNodeDetailsErrors(contentNode || { id: contentNodeId });
170171
};
171172
}
172173

contentcuration/contentcuration/frontend/shared/utils/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ function _getMasteryModel(node) {
131131
}
132132

133133
function _getLearningActivity(node) {
134-
return Object.keys(node.learning_activities);
134+
return Object.keys(get(node, 'learning_activities', {}));
135135
}
136136

137137
function _getErrorMsg(error) {

contentcuration/contentcuration/frontend/shared/utils/validation.spec.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ describe('channelEdit utils', () => {
6262
const node = { title: ' ' };
6363
expect(getNodeTitleErrors(node)).toEqual([ValidationErrors.TITLE_REQUIRED]);
6464
});
65-
66-
it('returns an error for a undefined title', () => {
67-
const node = {};
68-
expect(getNodeTitleErrors(node)).toEqual([ValidationErrors.TITLE_REQUIRED]);
69-
});
7065
});
7166

7267
describe('getNodeLicenseErrors', () => {

0 commit comments

Comments
 (0)