mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-22 00:06:06 +08:00
fix(spec): fix thread list participants name undefined error
Summary: A change in the spec caused an error when message metatdata wasn't available. The specs were also not updated to reflect the change. fix thread list participants spec fix thread list spec Test Plan: edgehill --test Reviewers: bengotow Reviewed By: bengotow Differential Revision: https://review.inboxapp.com/D1372
This commit is contained in:
parent
24b29fd397
commit
18165d5ebb
|
@ -63,6 +63,11 @@ ThreadListParticipants = React.createClass
|
||||||
if list.length is 0
|
if list.length is 0
|
||||||
list.push(@props.thread.participants[0])
|
list.push(@props.thread.participants[0])
|
||||||
|
|
||||||
|
# Change the list to have the appropriate output format
|
||||||
|
list = list.map (contact) ->
|
||||||
|
contact: contact
|
||||||
|
unread: false # We don't have the data.
|
||||||
|
|
||||||
# We only ever want to show three. Ben...Kevin... Marty
|
# We only ever want to show three. Ben...Kevin... Marty
|
||||||
# But we want the *right* three.
|
# But we want the *right* three.
|
||||||
if list.length > 3
|
if list.length > 3
|
||||||
|
|
|
@ -40,20 +40,20 @@ describe "ThreadListParticipants", ->
|
||||||
in: [
|
in: [
|
||||||
new Message(unread: false, from: [@ben]),
|
new Message(unread: false, from: [@ben]),
|
||||||
]
|
]
|
||||||
out: [@ben]
|
out: [{contact: @ben, unread: false}]
|
||||||
},{
|
},{
|
||||||
name: 'single unread email'
|
name: 'single unread email'
|
||||||
in: [
|
in: [
|
||||||
new Message(unread: true, from: [@evan]),
|
new Message(unread: true, from: [@evan]),
|
||||||
]
|
]
|
||||||
out: [@evan]
|
out: [{contact: @evan, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'single unread response'
|
name: 'single unread response'
|
||||||
in: [
|
in: [
|
||||||
new Message(unread: false, from: [@ben]),
|
new Message(unread: false, from: [@ben]),
|
||||||
new Message(unread: true, from: [@evan]),
|
new Message(unread: true, from: [@evan]),
|
||||||
]
|
]
|
||||||
out: [@ben, @evan]
|
out: [{contact: @ben, unread: false}, {contact: @evan, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'two unread responses'
|
name: 'two unread responses'
|
||||||
in: [
|
in: [
|
||||||
|
@ -61,7 +61,9 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: true, from: [@evan]),
|
new Message(unread: true, from: [@evan]),
|
||||||
new Message(unread: true, from: [@kavya]),
|
new Message(unread: true, from: [@kavya]),
|
||||||
]
|
]
|
||||||
out: [@ben, @evan, @kavya]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{contact: @evan, unread: true},
|
||||||
|
{contact: @kavya, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'two unread responses (repeated participants)'
|
name: 'two unread responses (repeated participants)'
|
||||||
in: [
|
in: [
|
||||||
|
@ -69,7 +71,7 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: true, from: [@evan]),
|
new Message(unread: true, from: [@evan]),
|
||||||
new Message(unread: true, from: [@evanAgain]),
|
new Message(unread: true, from: [@evanAgain]),
|
||||||
]
|
]
|
||||||
out: [@ben, @evan]
|
out: [{contact: @ben, unread: false}, {contact: @evan, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'three unread responses (repeated participants)'
|
name: 'three unread responses (repeated participants)'
|
||||||
in: [
|
in: [
|
||||||
|
@ -78,7 +80,10 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: true, from: [@michael]),
|
new Message(unread: true, from: [@michael]),
|
||||||
new Message(unread: true, from: [@evanAgain]),
|
new Message(unread: true, from: [@evanAgain]),
|
||||||
]
|
]
|
||||||
out: [@ben, {spacer: true}, @michael, @evanAgain]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{spacer: true},
|
||||||
|
{contact: @michael, unread: true},
|
||||||
|
{contact: @evanAgain, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'three unread responses'
|
name: 'three unread responses'
|
||||||
in: [
|
in: [
|
||||||
|
@ -87,7 +92,10 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: true, from: [@michael]),
|
new Message(unread: true, from: [@michael]),
|
||||||
new Message(unread: true, from: [@kavya]),
|
new Message(unread: true, from: [@kavya]),
|
||||||
]
|
]
|
||||||
out: [@ben, {spacer: true}, @michael, @kavya]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{spacer: true},
|
||||||
|
{contact: @michael, unread: true},
|
||||||
|
{contact: @kavya, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'three unread responses to long thread'
|
name: 'three unread responses to long thread'
|
||||||
in: [
|
in: [
|
||||||
|
@ -99,7 +107,10 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: true, from: [@michael]),
|
new Message(unread: true, from: [@michael]),
|
||||||
new Message(unread: true, from: [@evanAgain]),
|
new Message(unread: true, from: [@evanAgain]),
|
||||||
]
|
]
|
||||||
out: [@ben, {spacer: true}, @michael, @evanAgain]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{spacer: true},
|
||||||
|
{contact: @michael, unread: true},
|
||||||
|
{contact: @evanAgain, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'single unread responses to long thread'
|
name: 'single unread responses to long thread'
|
||||||
in: [
|
in: [
|
||||||
|
@ -109,7 +120,10 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: false, from: [@ben]),
|
new Message(unread: false, from: [@ben]),
|
||||||
new Message(unread: true, from: [@evanAgain]),
|
new Message(unread: true, from: [@evanAgain]),
|
||||||
]
|
]
|
||||||
out: [@ben, {spacer: true}, @ben, @evanAgain]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{spacer: true},
|
||||||
|
{contact: @ben, unread: false},
|
||||||
|
{contact: @evanAgain, unread: true}]
|
||||||
},{
|
},{
|
||||||
name: 'long read thread'
|
name: 'long read thread'
|
||||||
in: [
|
in: [
|
||||||
|
@ -118,7 +132,10 @@ describe "ThreadListParticipants", ->
|
||||||
new Message(unread: false, from: [@michael]),
|
new Message(unread: false, from: [@michael]),
|
||||||
new Message(unread: false, from: [@ben]),
|
new Message(unread: false, from: [@ben]),
|
||||||
]
|
]
|
||||||
out: [@ben, {spacer: true}, @michael, @ben]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{spacer: true},
|
||||||
|
{contact: @michael, unread: false},
|
||||||
|
{contact: @ben, unread: false}]
|
||||||
}]
|
}]
|
||||||
|
|
||||||
for scenario in scenarios
|
for scenario in scenarios
|
||||||
|
@ -141,23 +158,26 @@ describe "ThreadListParticipants", ->
|
||||||
scenarios = [{
|
scenarios = [{
|
||||||
name: 'one participant'
|
name: 'one participant'
|
||||||
in: [@ben]
|
in: [@ben]
|
||||||
out: [@ben]
|
out: [{contact: @ben, unread: false}]
|
||||||
},{
|
},{
|
||||||
name: 'one participant (me)'
|
name: 'one participant (me)'
|
||||||
in: [me]
|
in: [me]
|
||||||
out: [me]
|
out: [{contact: me, unread: false}]
|
||||||
},{
|
},{
|
||||||
name: 'two participants'
|
name: 'two participants'
|
||||||
in: [@evan, @ben]
|
in: [@evan, @ben]
|
||||||
out: [@evan, @ben]
|
out: [{contact: @evan, unread: false}, {contact: @ben, unread: false}]
|
||||||
},{
|
},{
|
||||||
name: 'two participants (me)'
|
name: 'two participants (me)'
|
||||||
in: [@ben, me]
|
in: [@ben, me]
|
||||||
out: [@ben]
|
out: [{contact: @ben, unread: false}]
|
||||||
},{
|
},{
|
||||||
name: 'lots of participants'
|
name: 'lots of participants'
|
||||||
in: [@ben, @evan, @michael, @kavya]
|
in: [@ben, @evan, @michael, @kavya]
|
||||||
out: [@ben, {spacer: true}, @michael, @kavya]
|
out: [{contact: @ben, unread: false},
|
||||||
|
{spacer: true},
|
||||||
|
{contact: @michael, unread: false},
|
||||||
|
{contact: @kavya, unread: false}]
|
||||||
}]
|
}]
|
||||||
|
|
||||||
for scenario in scenarios
|
for scenario in scenarios
|
||||||
|
|
|
@ -216,7 +216,7 @@ describe "ThreadList", ->
|
||||||
spyOn(Actions, "archiveCurrentThread")
|
spyOn(Actions, "archiveCurrentThread")
|
||||||
spyOn(Actions, "archiveAndNext")
|
spyOn(Actions, "archiveAndNext")
|
||||||
spyOn(Actions, "archiveAndPrevious")
|
spyOn(Actions, "archiveAndPrevious")
|
||||||
ReactTestUtils.spyOnClass(ThreadList, "_computeColumns").andReturn(columns)
|
ReactTestUtils.spyOnClass(ThreadList, "_prepareColumns")
|
||||||
|
|
||||||
ThreadStore._resetInstanceVars()
|
ThreadStore._resetInstanceVars()
|
||||||
|
|
||||||
|
@ -227,6 +227,7 @@ describe "ThreadList", ->
|
||||||
@thread_list = ReactTestUtils.renderIntoDocument(
|
@thread_list = ReactTestUtils.renderIntoDocument(
|
||||||
<ThreadList />
|
<ThreadList />
|
||||||
)
|
)
|
||||||
|
@thread_list._columns = columns
|
||||||
|
|
||||||
it "renders into the document", ->
|
it "renders into the document", ->
|
||||||
expect(ReactTestUtils.isCompositeComponentWithType(@thread_list,
|
expect(ReactTestUtils.isCompositeComponentWithType(@thread_list,
|
||||||
|
@ -238,7 +239,7 @@ describe "ThreadList", ->
|
||||||
expect(@thread_list._onStarThread).toHaveBeenCalled()
|
expect(@thread_list._onStarThread).toHaveBeenCalled()
|
||||||
|
|
||||||
it "has the expected columns", ->
|
it "has the expected columns", ->
|
||||||
expect(@thread_list.state.columns).toEqual columns
|
expect(@thread_list._columns).toEqual columns
|
||||||
|
|
||||||
it "by default has zero children", ->
|
it "by default has zero children", ->
|
||||||
items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list, ListTabular.Item)
|
items = ReactTestUtils.scryRenderedComponentsWithType(@thread_list, ListTabular.Item)
|
||||||
|
|
Loading…
Reference in a new issue