GrafoscopioUtils/repository/Grafoscopio-Utils/MarkdeepTest.class.st

39 lines
1.4 KiB
Smalltalk

Class {
#name : #MarkdeepTest,
#superclass : #TestCase,
#category : #'Grafoscopio-Utils-Tests'
}
{ #category : #tests }
MarkdeepTest >> markdeepTestingPictureSnippet [
^ (XMLHTMLParser on: '<div st-class="LePictureSnippet" st-data="OrderedDictionary{''id'':''77774yaTDQC8sESSDssMzQ=='',''parent'':''RBSKVeCRDQCTTfVoCYJWrg=='',''url'':''https://i.imgur.com/OD9P0vG.png'',''created'':''29 January 2022 11:32:19.996608 pm'',''modified'':''29 January 2022 11:32:23.781937 pm'',''creator'':''&lt;unknown>'',''modifier'':''&lt;unknown>''}">
<center>
<figure>
<img src="https://i.imgur.com/OD9P0vG.png" width="60%"/>
<figcaption>*Network view of the Malleable Systems TiddlyWiki*
</figcaption>
</figure>
</center>
</div>') parseDocument
]
{ #category : #tests }
MarkdeepTest >> testLePictureImport [
| metadata |
metadata := STON fromString: (self markdeepTestingPictureSnippet xpath: '@st-data') stringValue.
self assert:
(LePictureSnippet new injectMetadataFrom: metadata)
]
{ #category : #tests }
MarkdeepTest >> testMetadaIncludesParentId [
| aPage aSnippetOne aSnippetTwo |
aPage := LeUIExamples new database pageBuilder title: 'Test Page'; add.
aSnippetOne := aPage snippetBuilder string: 'Parent snippet'; add.
aSnippetTwo := aPage snippetBuilder string: 'Child Snippet'; add.
aSnippetTwo parent: aSnippetOne.
self assert: (aSnippetTwo metadata values includes: aSnippetOne uidString)
]