2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  getNthReblogButton, getNthReblogged, getNthStatus, getNthStatusContent, getReblogsCount, getUrl, homeNavButton,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  notificationsNavButton, scrollToBottom, scrollToTop, sleep
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								} from '../utils'
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { loginAsFoobar } from '../roles'
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								import { postAs, reblogStatusAs } from '../serverActions'
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2018-03-06 21:32:51 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								fixture`101-reblog-unreblog.js`
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  .page`http://localhost:4002`
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('reblogs a status', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await postAs('foobar', 'hello this should be reblogged')
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatusContent(0).innerText).contains('should be reblogged')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthReblogButton(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // scroll down and back up to force an unrender
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await scrollToBottom()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await sleep(1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await scrollToTop()
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(notificationsNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(homeNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(notificationsNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/notifications')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(homeNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).eql('http://localhost:4002/')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthReblogButton(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('unreblogs a status', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await postAs('foobar', 'woot i wanna reblog this')
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatusContent(0).innerText).contains('woot i wanna')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthReblogButton(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthReblogButton(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  // scroll down and back up to force an unrender
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await scrollToBottom()
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await sleep(1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await scrollToTop()
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(notificationsNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(homeNavButton)
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(notificationsNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .navigateTo('/')
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthReblogButton(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								test('Keeps the correct reblogs count', async t => {
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  let { id } = await postAs('foobar', 'this will be reblogged')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await reblogStatusAs('foobar', id)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await reblogStatusAs('admin', id)
							 | 
						
					
						
							
								
									
										
										
										
											2018-05-26 13:51:41 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  await loginAsFoobar(t)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  await t
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthStatusContent(0).innerText).contains('this will be reblogged')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthStatus(0))
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/status')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('true')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getReblogsCount()).eql(2)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(homeNavButton)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).eql('http://localhost:4002/')
							 | 
						
					
						
							
								
									
										
										
										
											2018-11-21 22:08:37 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    .hover(getNthStatus(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthReblogButton(0))
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .click(getNthStatus(0))
							 | 
						
					
						
							
								
									
										
										
										
											2018-02-24 18:20:33 -08:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getUrl()).contains('/status')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getNthReblogged(0)).eql('false')
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    .expect(getReblogsCount()).eql(1)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								})
							 |