Skip to content

Commit 9ae0eac

Browse files
author
quentin.moutte.etu
committed
add test for initializeMonthList
1 parent e5d3d58 commit 9ae0eac

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/Microdown-Blog-Tests/MicBlogCreatorTest.class.st

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,14 @@ MicBlogCreatorTest >> testCreateAllHtmlFile [
144144
{ #category : 'tests' }
145145
MicBlogCreatorTest >> testCreateFromTo [
146146

147-
| allFile nbMonthFile |
147+
| allFile |
148148
MicBlogCreator
149149
createFrom: fileSystem / 'source'
150150
to: fileSystem / 'html'.
151151

152152
allFile := (fileSystem / 'html') allFiles.
153-
154-
nbMonthFile := (Date today year - 2014) * 12 + Date today month index.
155153

156-
self assert: allFile size equals: 5 + nbMonthFile
154+
self assert: allFile size equals: 7
157155
]
158156

159157
{ #category : 'tests' }
@@ -220,6 +218,22 @@ MicBlogCreatorTest >> testCreateHtmlSummarize [
220218
self assert: (fileSystem / 'html/index.html') exists
221219
]
222220

221+
{ #category : 'tests' }
222+
MicBlogCreatorTest >> testInitializeMonthList [
223+
224+
| listSingleSummarizer |
225+
226+
listSingleSummarizer := Array new: 3.
227+
228+
listSingleSummarizer at:1 put: (MicSingleSummarizer new summarizeFile: fileSystem / 'source/anExample1.md').
229+
listSingleSummarizer at:2 put: (MicSingleSummarizer new summarizeFile: fileSystem / 'source/anExample2.md').
230+
listSingleSummarizer at:3 put: (MicSingleSummarizer new summarizeFile: fileSystem / 'source/test/anExample3.md').
231+
232+
blog initializeMonthList: listSingleSummarizer.
233+
234+
self assert: (fileSystem / 'html/_monthBlog') allFiles size equals: 2.
235+
]
236+
223237
{ #category : 'tests' }
224238
MicBlogCreatorTest >> testRenameMarkdownIntoHtmlFile [
225239

src/Microdown-Blog/MicBlogCreator.class.st

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ MicBlogCreator >> initializeMonthList: listOfSingleSummarize [
151151
sum targetDirectory: targetDirectory.
152152

153153
dateList := MicMonthListCreator new generateDateListSince2014.
154+
date := dateList copy.
154155

155-
dateList do: [ :each |
156+
date do: [ :each |
156157
summar := sum group: listOfSingleSummarize byDate: each.
157158
summar isEmpty ifTrue: [ dateList := dateList copyWithout: each ] ].
158159

0 commit comments

Comments
 (0)