Skip to content

Commit

Permalink
Merge origin/development into development
Browse files Browse the repository at this point in the history
  • Loading branch information
tanja04 committed Jul 8, 2024
2 parents 7e2fbed + b77fc2e commit be36fa6
Show file tree
Hide file tree
Showing 3 changed files with 305 additions and 833 deletions.
303 changes: 303 additions & 0 deletions src/SpotifyConnect/SPOCMockTestTinkerResponse.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
"
Tests the tinker reponse method for API requests.
"
Class {
#name : #SPOCMockTestTinkerResponse,
#superclass : #TestCase,
#instVars : [
'album',
'apiEndpoint',
'artist',
'device',
'playbackState',
'playlist',
'track'
],
#category : #'SpotifyConnect-Mock-Tests',
#'squeak_changestamp' : 'OW 7/4/2024 12:28'
}

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> album [

^ album
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> album: anObject [

album := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/11/2024 00:08'
}
SPOCMockTestTinkerResponse >> apiEndpoint [

^ apiEndpoint
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/11/2024 00:08'
}
SPOCMockTestTinkerResponse >> apiEndpoint: anObject [

apiEndpoint := anObject
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> artist [

^ artist
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> artist: anObject [

artist := anObject
]

{
#category : #setup,
#'squeak_changestamp' : 'TL 6/12/2024 00:38'
}
SPOCMockTestTinkerResponse >> artists [

^ {(SPOCArtist new
id: '1c3uso4iIeeX3P0bhKaQDq';
name: 'Jaxomy';
yourself).
(SPOCArtist new
id: '124jbwgd8Hh6LW7jAqTa8r';
name: 'Agatino Romero';
yourself).
(SPOCArtist new
id: '6EVyI0S0b1Ld2nm37m5x85';
name: 'Raffaella Carrà';
yourself)} asOrderedCollection
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> device [

^ device
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> device: anObject [

device := anObject
]

{
#category : #mocks,
#'squeak_changestamp' : 'OW 7/8/2024 21:51'
}
SPOCMockTestTinkerResponse >> mockJSONPlaybackState [

^ Json readFrom: (SPOCApiPlaybackState new loadMockdataFromAsset: 'playbackStateResponse')
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> playbackState [

^ playbackState
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> playbackState: anObject [

playbackState := anObject
]

{
#category : #setup,
#'squeak_changestamp' : 'TL 6/24/2024 04:26'
}
SPOCMockTestTinkerResponse >> setUp [

self apiEndpoint: SPOCApiEndpoint new;
setUpDevice;
setUpArtist;
setUpAlbum;
setUpTrack;
setUpPlaybackState

]

{
#category : #setup,
#'squeak_changestamp' : 'RK 7/7/2024 13:13'
}
SPOCMockTestTinkerResponse >> setUpAlbum [

self album: (SPOCAlbum new
id: '5y6RXjI5VPR0RyInghTbf1';
name: 'Pedro';
image: (SPOCImage newWithUrl: 'https://i.scdn.co/image/ab67616d0000b27384464d902b1ebaf62775a6da');
artists: self artists;
totalTracks: 1;
hasTertiaryText: false;
yourself)
]

{
#category : #setup,
#'squeak_changestamp' : 'TL 6/24/2024 04:26'
}
SPOCMockTestTinkerResponse >> setUpArtist [

self artist: (SPOCArtist new
id: '1c3uso4iIeeX3P0bhKaQDq';
name: 'Jaxomy';
yourself)

]

{
#category : #setup,
#'squeak_changestamp' : 'TL 6/11/2024 11:56'
}
SPOCMockTestTinkerResponse >> setUpDevice [

self device: (SPOCDevice new
id: 'b704b454bce64526992a3f207723032f5f91e635';
isActive: true;
name: 'TL-04';
supportsVolume: true;
type: 'Computer';
volume: 100;
yourself)
]

{
#category : #setup,
#'squeak_changestamp' : 'TL 6/12/2024 01:29'
}
SPOCMockTestTinkerResponse >> setUpPlaybackState [

self playbackState: (SPOCPlaybackState new
device: self device;
isPlaying: true;
progress: 66236;
track: self track;
yourself)
]

{
#category : #setup,
#'squeak_changestamp' : 'RK 7/7/2024 13:13'
}
SPOCMockTestTinkerResponse >> setUpTrack [

self track: (SPOCTrack new
id: '48lxT5qJF0yYyf2z4wB4xW';
name: 'Pedro';
image: (SPOCImage newWithUrl: 'https://i.scdn.co/image/ab67616d0000b27384464d902b1ebaf62775a6da');
album: self album;
artists: self artists;
duration: 144;
trackNumber: 1;
hasTertiaryText: true;
yourself)

]

{
#category : #testing,
#'squeak_changestamp' : 'OW 7/8/2024 21:51'
}
SPOCMockTestTinkerResponse >> testTinkerAlbum [

| res |
res := self apiEndpoint tinkerAlbum: ((self mockJSONPlaybackState at: #item) at: #album).
self assert: (res equals: self album)
]

{
#category : #testing,
#'squeak_changestamp' : 'OW 7/8/2024 21:51'
}
SPOCMockTestTinkerResponse >> testTinkerArtist [

| res |
res := self apiEndpoint tinkerArtist: (((self mockJSONPlaybackState at: #item) at: #artists) first).
self assert: (res equals: self artist)
]

{
#category : #testing,
#'squeak_changestamp' : 'OW 7/8/2024 21:51'
}
SPOCMockTestTinkerResponse >> testTinkerDevice [

| res |
res := self apiEndpoint tinkerDevice: (self mockJSONPlaybackState at: #device).
self assert: (res equals: self device)
]

{
#category : #testing,
#'squeak_changestamp' : 'OW 7/8/2024 21:51'
}
SPOCMockTestTinkerResponse >> testTinkerPlaybackState [

| res |
res := self apiEndpoint tinkerPlaybackState: self mockJSONPlaybackState.
self assert: (res equals: self playbackState)
]

{
#category : #testing,
#'squeak_changestamp' : 'OW 7/8/2024 21:51'
}
SPOCMockTestTinkerResponse >> testTinkerTrack [

| res |
res := self apiEndpoint tinkerTrack: (self mockJSONPlaybackState at: #item).
self assert: (res equals: self track)
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> track [

^ track
]

{
#category : #accessing,
#'squeak_changestamp' : 'TL 6/10/2024 23:50'
}
SPOCMockTestTinkerResponse >> track: anObject [

track := anObject
]
3 changes: 2 additions & 1 deletion src/SpotifyConnect/SPOCTestClickable.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ SPOCTestClickable >> testClickableAction [

{
#category : #testing,
#'squeak_changestamp' : 'TL 6/10/2024 05:03'
#'squeak_changestamp' : 'VE 7/8/2024 19:24'
}
SPOCTestClickable >> testClickableActionNotSet [

| clickable |
clickable := SPOCClickable new.
self should: [clickable mouseDown: nil] raise: Error
]

Expand Down
Loading

0 comments on commit be36fa6

Please sign in to comment.