@@ -81,6 +81,52 @@ describe('\'contributions\' service', () => {
8181 assert . ok ( notification . relatedContributionId , 'has relatedContributionId' ) ;
8282 assert . equal ( notification . relatedContributionId , contribution . _id , 'has correct relatedContributionId' ) ;
8383 } ) ;
84+
85+ context ( 'given soft-deleted contribution' , ( ) => {
86+ const contributionAttributes = {
87+ title : 'title' ,
88+ type : 'post' ,
89+ content : 'blah' ,
90+ language : 'en' ,
91+ } ;
92+
93+ beforeEach ( async ( ) => {
94+ const deletedContributionAttributes = Object . assign ( { } , contributionAttributes , {
95+ deleted : true ,
96+ slug : 'title'
97+ } ) ;
98+ await service . create ( deletedContributionAttributes , params ) ;
99+ } ) ;
100+
101+ it ( 'increments title slug' , async ( ) => {
102+ let contribution = await service . create ( contributionAttributes , params ) ;
103+ assert . ok ( contribution , 'created contribution' ) ;
104+ assert . equal ( contribution . slug , 'title1' ) ;
105+ } ) ;
106+ } ) ;
107+
108+ context ( 'given disabled contribution' , ( ) => {
109+ const contributionAttributes = {
110+ title : 'title' ,
111+ type : 'post' ,
112+ content : 'blah' ,
113+ language : 'en' ,
114+ } ;
115+
116+ beforeEach ( async ( ) => {
117+ const disabledContributionAttributes = Object . assign ( { } , contributionAttributes , {
118+ isEnabled : false ,
119+ slug : 'title'
120+ } ) ;
121+ await service . create ( disabledContributionAttributes , params ) ;
122+ } ) ;
123+
124+ it ( 'increments title slug' , async ( ) => {
125+ let contribution = await service . create ( contributionAttributes , params ) ;
126+ assert . ok ( contribution , 'created contribution' ) ;
127+ assert . equal ( contribution . slug , 'title1' ) ;
128+ } ) ;
129+ } ) ;
84130 } ) ;
85131
86132 describe ( 'contributions patch' , ( ) => {
0 commit comments