Improving test coverage examples.

This commit is contained in:
Diego Ruidajo 2022-01-21 20:25:52 -05:00
parent 401168ac91
commit 07cd424cee
2 changed files with 39 additions and 7 deletions

View File

@ -14,7 +14,7 @@ Class {
{ #category : #accessing }
TWSeed class >> default [
^ (self list select: [ :seed | seed name = 'ProjectifyMod' ]) first
^ self selectSeed: 'ProjectifyMod'
]
{ #category : #accessing }
@ -37,7 +37,7 @@ TWSeed class >> initialize [
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/projectify/projectify-mod.html');
add: (self new
name: 'Wikilexias';
demo: '');
demo: 'https://mutabit.com/repos.fossil/tiddlywiki/uv/seeds/wikilexias/wikilexias.html');
add: (self new
name: 'NotebookMod';
demo: '');
@ -52,10 +52,10 @@ TWSeed class >> initialize [
]
{ #category : #accessing }
TWSeed class >> installDefaultInto: folder as: shortName [
TWSeed class >> install: seedName into: folder as: shortName [
| url subfolder file |
url := self default demo.
| file url seedFile subfolder wiki |
seedFile := self selectSeed: seedName.
subfolder := (folder / shortName) ensureCreateDirectory.
file := subfolder / 'index.html'.
file exists
@ -64,8 +64,18 @@ TWSeed class >> installDefaultInto: folder as: shortName [
2 run:
self deleteWikiFileFromFolder: folder andSubfolder: shortName.'.
^ self
].
^ url asUrl saveContentsToFile: file.
].
url := seedFile demo.
url asUrl saveContentsToFile: file.
^ wiki := TiddlyWiki new
file: file;
name: shortName.
]
{ #category : #accessing }
TWSeed class >> installDefaultInto: folder as: shortName [
^ self install: 'ProjectifyMod' into: folder as: shortName
]
{ #category : #accessing }
@ -78,6 +88,12 @@ TWSeed class >> list [
]
{ #category : #accessing }
TWSeed class >> selectSeed: aSeedName [
^ (self list select: [ :seed | seed name = aSeedName ]) first
]
{ #category : #accessing }
TWSeed >> demo [

View File

@ -4,6 +4,22 @@ Class {
#category : #'TiddlyWiki-TiddlyWiki'
}
{ #category : #accessing }
TWSeedTest >> testCreateAlternativeSeed [
| seed |
seed := TWSeed install: 'Wikilexias' into: FileLocator temp as: 'Wikilexias'.
self assert: seed file equals: (FileLocator temp / 'Wikilexias' / 'index.html')
]
{ #category : #accessing }
TWSeedTest >> testDefaultIsSeed [
| seed |
seed := TWSeed default.
self assert: seed class equals: TWSeed
]
{ #category : #accessing }
TWSeedTest >> testListIsNotEmpty [