Notepad <Notes>
Hierarchy
- TinyType
- Notepad
Index
Methods
staticempty
Instantiates a new empty Notepad.
Type parameters
- N: Record<any, any>
Returns Notepad<N>
staticwith
Instantiates a new Notepad with an initial state.
import { actorCalled, Notepad, notes, TakeNotes } from '@serenity-js/core'
import { Ensure, equals } from '@serenity-js/assertions'
interface MyNotes {
personalDetails: {
firstName: string;
lastName: string;
}
}
actorCalled('Leonard')
.whoCan(
TakeNotes.using(
Notepad.with<MyNotes>({
personalDetails: {
firstName: 'Leonard',
lastName: 'McLaud',
}
})
)
)
.attemptsTo(
Ensure.that(
notes<MyNotes>().get('personalDetails').firstName,
equals('Leonard')
),
)Type parameters
- N: Record<any, any>
Parameters
notes: N
Returns Notepad<N>
staticnotes
Creates a QuestionAdapter that simplifies access to the notes stored in this notepad. Allows the Actor to record, read, and remove notes.
Learn more
Type parameters
- N: Record<any, any>
Returns NotepadAdapter<N>
externalequals
Parameters
externalanother: TinyType
Returns boolean
externaltoString
Returns string
externaltoJSON
Returns JSONValue
has
Checks if a note identified by
subject
exists in the notepad.Type parameters
- Subject: string | number | symbol
Parameters
subject: Subject
A subject (name) that uniquely identifies a given note
Returns boolean
true
if the note exists,false
otherwise
get
Retrieves a note, identified by
subject
, from the notepad.Type parameters
- Subject: string | number | symbol
Parameters
subject: Subject
A subject (name) that uniquely identifies a given note
Returns Notes[Subject]
The value of the previously recorded note.
set
Stores a given
value
uniquely identified bysubject
in the notepad.Type parameters
- Subject: string | number | symbol
Parameters
subject: Subject
A subject (name) that uniquely identifies a given note
value: Notes[Subject]
The value to record.
Returns Notepad<Notes>
delete
Removes the note identified by
subject
from the notepad.Type parameters
- Subject: string | number | symbol
Parameters
subject: Subject
Returns boolean
true
if the item in the Notepad object existed and has been removed,false
otherwise.
clear
Deletes all the notes stored in this notepad.
Returns void
size
Returns the number of notes stored in the notepad.
Returns number
Stores notes recorded by an Actor.
See TakeNotes and notes for more usage examples.
Sharing a notepad between actors
Learn more