Download pool/shard011/JavaScript/0069006_AddMovie.spec.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069006_AddMovie.spec.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard011/JavaScript/0069006_AddMovie.spec.js
-
curl -L -o 0069006_AddMovie.spec.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069006_AddMovie.spec.js
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) | |
| } | |
| }) | |
| }) | |
| }) | |