diff --git a/src/Web/Slack/Conversation.hs b/src/Web/Slack/Conversation.hs index fd2a6c9..be36213 100644 --- a/src/Web/Slack/Conversation.hs +++ b/src/Web/Slack/Conversation.hs @@ -126,7 +126,7 @@ data ChannelConversation = ChannelConversation -- ^ Absent from @users.conversations@ response , channelTopic :: Topic , channelPurpose :: Purpose - , channelPreviousNames :: [Text] + , channelPreviousNames :: Maybe [Text] , channelNumMembers :: Maybe Integer -- ^ Absent from @conversations.join@ response } diff --git a/tests/Web/Slack/ConversationSpec.hs b/tests/Web/Slack/ConversationSpec.hs index 6cb4820..c9b91d8 100644 --- a/tests/Web/Slack/ConversationSpec.hs +++ b/tests/Web/Slack/ConversationSpec.hs @@ -114,6 +114,7 @@ spec = describe "ToJSON and FromJSON for Conversation" $ do describe "Golden tests" $ do mapM_ (oneGoldenTestDecode @Conversation) ["shared_channel"] + mapM_ (oneGoldenTestDecode @Conversation) ["no_previous_names"] mapM_ (oneGoldenTestDecode @InfoRsp) ["general"] mapM_ (oneGoldenTestDecode @JoinRsp) ["test"] mapM_ (oneGoldenTestDecode @MembersRsp) ["test"] diff --git a/tests/golden/Conversation/no_previous_names.golden b/tests/golden/Conversation/no_previous_names.golden new file mode 100644 index 0000000..8f522dc --- /dev/null +++ b/tests/golden/Conversation/no_previous_names.golden @@ -0,0 +1,32 @@ +Channel + ( ChannelConversation + { channelId = ConversationId + { unConversationId = "C0000000000" } + , channelName = "shared-channel" + , channelCreated = 1667519517 + , channelIsArchived = False + , channelIsGeneral = False + , channelUnlinked = 0 + , channelNameNormalized = "shared-channel" + , channelIsShared = True + , channelCreator = UserId + { unUserId = "UAAAAAAAA" } + , channelIsExtShared = True + , channelIsOrgShared = False + , channelSharedTeamIds = Nothing + , channelIsPendingExtShared = False + , channelIsMember = Just False + , channelTopic = Topic + { topicValue = "" + , topicCreator = "" + , topicLastSet = 0 + } + , channelPurpose = Purpose + { purposeValue = "" + , purposeCreator = "" + , purposeLastSet = 0 + } + , channelPreviousNames = Nothing + , channelNumMembers = Just 12 + } + ) diff --git a/tests/golden/Conversation/no_previous_names.json b/tests/golden/Conversation/no_previous_names.json new file mode 100644 index 0000000..c1aa9fc --- /dev/null +++ b/tests/golden/Conversation/no_previous_names.json @@ -0,0 +1,36 @@ +{ + "id": "C0000000000", + "name": "shared-channel", + "is_channel": true, + "is_group": false, + "is_im": false, + "is_mpim": false, + "is_private": false, + "created": 1667519517, + "is_archived": false, + "is_general": false, + "unlinked": 0, + "name_normalized": "shared-channel", + "is_shared": true, + "is_org_shared": false, + "is_pending_ext_shared": false, + "pending_shared": [], + "context_team_id": "TAAAAAAAA", + "parent_conversation": null, + "creator": "UAAAAAAAA", + "is_ext_shared": true, + "pending_connected_team_ids": [], + "conversation_host_id": "TAAAAAAAA", + "is_member": false, + "topic": { + "value": "", + "creator": "", + "last_set": 0 + }, + "purpose": { + "value": "", + "creator": "", + "last_set": 0 + }, + "num_members": 12 +} diff --git a/tests/golden/Conversation/shared_channel.golden b/tests/golden/Conversation/shared_channel.golden index e1eab03..a7ef4aa 100644 --- a/tests/golden/Conversation/shared_channel.golden +++ b/tests/golden/Conversation/shared_channel.golden @@ -26,7 +26,7 @@ Channel , purposeCreator = "" , purposeLastSet = 0 } - , channelPreviousNames = [] + , channelPreviousNames = Just [] , channelNumMembers = Just 12 } - ) \ No newline at end of file + ) diff --git a/tests/golden/InfoRsp/general.golden b/tests/golden/InfoRsp/general.golden index f96e44b..596241f 100644 --- a/tests/golden/InfoRsp/general.golden +++ b/tests/golden/InfoRsp/general.golden @@ -30,8 +30,8 @@ InfoRsp , purposeCreator = "U043H11ES4V" , purposeLastSet = 1663890553 } - , channelPreviousNames = [] + , channelPreviousNames = Just [] , channelNumMembers = Nothing } ) - } \ No newline at end of file + } diff --git a/tests/golden/JoinRsp/test.golden b/tests/golden/JoinRsp/test.golden index ef17046..912b752 100644 --- a/tests/golden/JoinRsp/test.golden +++ b/tests/golden/JoinRsp/test.golden @@ -30,8 +30,8 @@ JoinRsp , purposeCreator = "" , purposeLastSet = 0 } - , channelPreviousNames = [] + , channelPreviousNames = Just [] , channelNumMembers = Nothing } ) - } \ No newline at end of file + } diff --git a/tests/golden/UsersConversationsResponse/im_and_channels.golden b/tests/golden/UsersConversationsResponse/im_and_channels.golden index 8d52082..e43cc43 100644 --- a/tests/golden/UsersConversationsResponse/im_and_channels.golden +++ b/tests/golden/UsersConversationsResponse/im_and_channels.golden @@ -31,7 +31,7 @@ UsersConversationsResponse , purposeCreator = "U043H11ES4V" , purposeLastSet = 1663890553 } - , channelPreviousNames = [] + , channelPreviousNames = Just [] , channelNumMembers = Nothing } ) @@ -66,7 +66,7 @@ UsersConversationsResponse , purposeCreator = "" , purposeLastSet = 0 } - , channelPreviousNames = [] + , channelPreviousNames = Just [] , channelNumMembers = Nothing } ) @@ -105,4 +105,4 @@ UsersConversationsResponse ) } ) - } \ No newline at end of file + }