Pendigard's picture
Upload folder using huggingface_hub (part 123)
cf0f72e verified
Raw History Blame Contribute Delete
1.2 kB
import React from 'react'
import { shallow } from 'enzyme'
import toJson from 'enzyme-to-json'
import { AddMovie } from '../AddMovie'
describe('components/AddMovie', () => {
let component
let instance
let mutate
let navigation
beforeEach(() => {
mutate = jest.fn()
navigation = {
navigate: jest.fn()
}
component = shallow(<AddMovie mutate={mutate} navigation={navigation} />)
instance = component.instance()
})
it('renders AddMovie', () => {
expect(toJson(component)).toMatchSnapshot()
})
describe('#insertMovie', () => {
it('should call mutate with correct variables', async () => {
try {
await instance.insertMovie()
expect(mutate).toHaveBeenCalledWith({
variables: {
input: {
imdbId: '',
rating: 0,
userId: 2
}
}
})
} catch (e) {
throw new Error(e)
}
})
it('should navigate back to Feed', async () => {
try {
await instance.insertMovie()
expect(navigation.navigate).toHaveBeenCalledWith('Feed')
} catch (e) {
throw new Error(e)
}
})
})
})