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

View File

@ -4,6 +4,22 @@ Class {
#category : #'TiddlyWiki-TiddlyWiki' #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 } { #category : #accessing }
TWSeedTest >> testListIsNotEmpty [ TWSeedTest >> testListIsNotEmpty [