Skip to content

Commit 14fe15b

Browse files
authored
chore(schema-validation): remove unused action (#6785)
chore(validation): remove unused action
1 parent ad76004 commit 14fe15b

File tree

2 files changed

+1
-63
lines changed

2 files changed

+1
-63
lines changed

packages/compass-schema-validation/src/modules/validation.spec.ts

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ import reducer, {
99
validationFetched,
1010
validationCanceled,
1111
validationSaveFailed,
12-
syntaxErrorOccurred,
1312
validationFromCollection,
1413
VALIDATOR_CHANGED,
1514
VALIDATION_CANCELED,
1615
VALIDATION_SAVE_FAILED,
1716
VALIDATION_FETCHED,
1817
VALIDATION_ACTION_CHANGED,
1918
VALIDATION_LEVEL_CHANGED,
20-
SYNTAX_ERROR_OCCURRED,
2119
} from './validation';
2220

2321
describe('validation module', function () {
@@ -119,15 +117,6 @@ describe('validation module', function () {
119117
});
120118
});
121119

122-
describe('#syntaxErrorOccurred', function () {
123-
it('returns the SYNTAX_ERROR_OCCURRED action', function () {
124-
expect(syntaxErrorOccurred({ message: 'Syntax Error!' })).to.deep.equal({
125-
type: SYNTAX_ERROR_OCCURRED,
126-
syntaxError: { message: 'Syntax Error!' },
127-
});
128-
});
129-
});
130-
131120
describe('validationFromCollection', function () {
132121
context('when an error occurs listing the collection', function () {
133122
it('includes the error', function () {
@@ -324,23 +313,5 @@ describe('validation module', function () {
324313
});
325314
});
326315
});
327-
328-
context('when the action is syntaxErrorOccurred', function () {
329-
it('returns the new state', function () {
330-
const validation = reducer(
331-
undefined,
332-
syntaxErrorOccurred({ message: 'Syntax Error!' })
333-
);
334-
335-
expect(validation).to.deep.equal({
336-
validator: '',
337-
validationAction: 'error',
338-
validationLevel: 'strict',
339-
isChanged: true,
340-
syntaxError: { message: 'Syntax Error!' },
341-
error: null,
342-
});
343-
});
344-
});
345316
});
346317
});

packages/compass-schema-validation/src/modules/validation.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,13 @@ interface ValidationLevelChangedAction {
7575
validationLevel: ValidationLevel;
7676
}
7777

78-
/**
79-
* Syntax error occurred action name.
80-
*/
81-
export const SYNTAX_ERROR_OCCURRED = `${PREFIX}/SYNTAX_ERROR_OCCURRED` as const;
82-
interface SyntaxErrorOccurredAction {
83-
type: typeof SYNTAX_ERROR_OCCURRED;
84-
syntaxError: null | { message: string };
85-
}
86-
8778
export type ValidationAction =
8879
| ValidatorChangedAction
8980
| ValidationCanceledAction
9081
| ValidationSaveFailedAction
9182
| ValidationFetchedAction
9283
| ValidationActionChangedAction
93-
| ValidationLevelChangedAction
94-
| SyntaxErrorOccurredAction;
84+
| ValidationLevelChangedAction;
9585

9686
export interface Validation {
9787
validator: string;
@@ -178,18 +168,6 @@ const changeValidator = (
178168
};
179169
};
180170

181-
/**
182-
* Sets syntax error.
183-
*/
184-
const setSyntaxError = (
185-
state: ValidationState,
186-
action: SyntaxErrorOccurredAction
187-
): ValidationState => ({
188-
...state,
189-
isChanged: true,
190-
syntaxError: action.syntaxError,
191-
});
192-
193171
/**
194172
* Set validation.
195173
*/
@@ -291,7 +269,6 @@ const MAPPINGS: {
291269
[VALIDATION_SAVE_FAILED]: setError,
292270
[VALIDATION_ACTION_CHANGED]: changeValidationAction,
293271
[VALIDATION_LEVEL_CHANGED]: changeValidationLevel,
294-
[SYNTAX_ERROR_OCCURRED]: setSyntaxError,
295272
};
296273

297274
/**
@@ -372,16 +349,6 @@ export const validationSaveFailed = (error: {
372349
error,
373350
});
374351

375-
/**
376-
* Action creator for syntax error occurred events.
377-
*/
378-
export const syntaxErrorOccurred = (
379-
syntaxError: null | { message: string }
380-
): SyntaxErrorOccurredAction => ({
381-
type: SYNTAX_ERROR_OCCURRED,
382-
syntaxError,
383-
});
384-
385352
export const fetchValidation = (namespace: {
386353
database: string;
387354
collection: string;

0 commit comments

Comments
 (0)