Improve lightbox... and update to React Native 0.71.0 (#49)
* Switch to a better lightbox implementation (close #42) * Upgrade to react-native 0.71.0 * Update (or remove low-value) tests
This commit is contained in:
parent
61682d5846
commit
065d7ef629
42 changed files with 2000 additions and 3088 deletions
|
@ -1,6 +1,5 @@
|
|||
import {RootStoreModel} from '../../../src/state/models/root-store'
|
||||
import {MeModel} from '../../../src/state/models/me'
|
||||
import {MembershipsViewModel} from './../../../src/state/models/memberships-view'
|
||||
import {NotificationsViewModel} from './../../../src/state/models/notifications-view'
|
||||
import {sessionClient, SessionServiceClient} from '@atproto/api'
|
||||
import {DEFAULT_SERVICE} from './../../../src/state/index'
|
||||
|
@ -33,7 +32,6 @@ describe('MeModel', () => {
|
|||
expect(meModel.description).toEqual('')
|
||||
expect(meModel.avatar).toEqual('')
|
||||
expect(meModel.notificationCount).toEqual(0)
|
||||
expect(meModel.memberships).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should hydrate() successfully with valid properties', () => {
|
||||
|
@ -137,7 +135,6 @@ describe('MeModel', () => {
|
|||
expect(meModel.description).toEqual('')
|
||||
expect(meModel.avatar).toEqual('')
|
||||
expect(meModel.notificationCount).toEqual(0)
|
||||
expect(meModel.memberships).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should serialize() key information', () => {
|
||||
|
|
|
@ -16,19 +16,6 @@ describe('rootStore', () => {
|
|||
jest.clearAllMocks()
|
||||
})
|
||||
|
||||
it('resolveName() handles inputs correctly', () => {
|
||||
const spyMethod = jest
|
||||
.spyOn(rootStore.api.com.atproto.handle, 'resolve')
|
||||
.mockResolvedValue({success: true, headers: {}, data: {did: 'testdid'}})
|
||||
|
||||
rootStore.resolveName('teststring')
|
||||
expect(spyMethod).toHaveBeenCalledWith({handle: 'teststring'})
|
||||
|
||||
expect(rootStore.resolveName('')).rejects.toThrow('Invalid handle: ""')
|
||||
|
||||
expect(rootStore.resolveName('did:123')).resolves.toReturnWith('did:123')
|
||||
})
|
||||
|
||||
it('should call the clearAll() resets state correctly', () => {
|
||||
rootStore.clearAll()
|
||||
|
||||
|
@ -68,6 +55,5 @@ describe('rootStore', () => {
|
|||
expect(rootStore.me.description).toEqual('')
|
||||
expect(rootStore.me.avatar).toEqual('')
|
||||
expect(rootStore.me.notificationCount).toEqual(0)
|
||||
expect(rootStore.me.memberships).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
ConfirmModal,
|
||||
ImageLightbox,
|
||||
ImagesLightbox,
|
||||
ShellUiModel,
|
||||
} from './../../../src/state/models/shell-ui'
|
||||
|
||||
|
@ -16,9 +16,10 @@ describe('ShellUiModel', () => {
|
|||
})
|
||||
|
||||
it('should call the openModal & closeModal method', () => {
|
||||
model.openModal(ConfirmModal)
|
||||
const m = new ConfirmModal('Test Modal', 'Look good?', () => {})
|
||||
model.openModal(m)
|
||||
expect(model.isModalActive).toEqual(true)
|
||||
expect(model.activeModal).toEqual(ConfirmModal)
|
||||
expect(model.activeModal).toEqual(m)
|
||||
|
||||
model.closeModal()
|
||||
expect(model.isModalActive).toEqual(false)
|
||||
|
@ -26,9 +27,10 @@ describe('ShellUiModel', () => {
|
|||
})
|
||||
|
||||
it('should call the openLightbox & closeLightbox method', () => {
|
||||
model.openLightbox(new ImageLightbox('uri'))
|
||||
const lt = new ImagesLightbox(['uri'], 0)
|
||||
model.openLightbox(lt)
|
||||
expect(model.isLightboxActive).toEqual(true)
|
||||
expect(model.activeLightbox).toEqual(new ImageLightbox('uri'))
|
||||
expect(model.activeLightbox).toEqual(lt)
|
||||
|
||||
model.closeLightbox()
|
||||
expect(model.isLightboxActive).toEqual(false)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue