Skip to content

Commit 9cfc444

Browse files
authored
Update Suggestion model with NOT_VALID status (#1066)
Please ensure your pull request adheres to the following guidelines: - [ ] make sure to link the related issues in this description - [ ] when merging / squashing, make sure the fixed issue references are visible in the commits, for easy compilation of release notes ## Related Issues Thanks for contributing!
1 parent 93b0fcf commit 9cfc444

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

packages/spacecat-shared-data-access/src/models/suggestion/suggestion.model.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class Suggestion extends BaseModel {
2929
FIXED: 'FIXED',
3030
ERROR: 'ERROR',
3131
OUTDATED: 'OUTDATED',
32+
PENDING_VALIDATION: 'PENDING_VALIDATION',
3233
};
3334

3435
static TYPES = {

packages/spacecat-shared-data-access/test/unit/models/suggestion/suggestion.collection.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('SuggestionCollection', () => {
100100

101101
it('throws an error if status is not provided', async () => {
102102
await expect(instance.bulkUpdateStatus([model], 'foo'))
103-
.to.be.rejectedWith('Invalid status: foo. Must be one of: NEW, APPROVED, IN_PROGRESS, SKIPPED, FIXED, ERROR');
103+
.to.be.rejectedWith('Invalid status: foo. Must be one of: NEW, APPROVED, IN_PROGRESS, SKIPPED, FIXED, ERROR, OUTDATED, PENDING_VALIDATION');
104104
});
105105
});
106106

packages/spacecat-shared-data-access/test/unit/models/suggestion/suggestion.model.test.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,20 @@ chaiUse(chaiAsPromised);
2424
chaiUse(sinonChai);
2525

2626
describe('SuggestionModel', () => {
27+
describe('STATUSES', () => {
28+
it('has STATUSES enum', () => {
29+
expect(Suggestion.STATUSES).to.be.an('object');
30+
expect(Suggestion.STATUSES.NEW).to.equal('NEW');
31+
expect(Suggestion.STATUSES.APPROVED).to.equal('APPROVED');
32+
expect(Suggestion.STATUSES.IN_PROGRESS).to.equal('IN_PROGRESS');
33+
expect(Suggestion.STATUSES.SKIPPED).to.equal('SKIPPED');
34+
expect(Suggestion.STATUSES.FIXED).to.equal('FIXED');
35+
expect(Suggestion.STATUSES.ERROR).to.equal('ERROR');
36+
expect(Suggestion.STATUSES.OUTDATED).to.equal('OUTDATED');
37+
expect(Suggestion.STATUSES.PENDING_VALIDATION).to.equal('PENDING_VALIDATION');
38+
});
39+
});
40+
2741
let instance;
2842

2943
let mockElectroService;
@@ -90,6 +104,11 @@ describe('SuggestionModel', () => {
90104
instance.setStatus('OUTDATED');
91105
expect(instance.record.status).to.equal('OUTDATED');
92106
});
107+
108+
it('sets the status of the suggestion to PENDING_VALIDATION', () => {
109+
instance.setStatus('PENDING_VALIDATION');
110+
expect(instance.record.status).to.equal('PENDING_VALIDATION');
111+
});
93112
});
94113

95114
describe('getRank and setRank', () => {

0 commit comments

Comments
 (0)