This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ShallowRenderer from 'react-test-renderer/shallow'; | |
import { ActivityIndicator} from 'react-native'; | |
import nock from 'nock'; | |
import TeamDetailsScreen from '../../../src/screens/TeamDetails'; | |
import TeamDetails from '../../../src/components/TeamDetails'; | |
import brazilMock from '../../fixtures/teams/brazil.json'; | |
const asyncFlush = () => new Promise(resolve => setTimeout(resolve, 100)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ShallowRenderer from 'react-test-renderer/shallow'; | |
import HomeScreen from '../../../src/screens/Home'; | |
import TeamsList from '../../../src/components/TeamsList'; | |
describe('HomeScreen', () => { | |
describe('render', () => { | |
it('show TeamsList component', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ShallowRenderer from 'react-test-renderer/shallow'; | |
import { ActivityIndicator, FlatList } from 'react-native'; | |
import nock from 'nock'; | |
import TeamsList from '../../../src/components/TeamsList'; | |
import teamsListExpectedData from '../../fixtures/httpResponses/teamsList' | |
const asyncFlush = () => new Promise(resolve => setTimeout(resolve, 100)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import renderer from 'react-test-renderer'; | |
import humps from 'humps'; | |
import { TouchableOpacity } from 'react-native'; | |
import TeamItem from '../../../src/components/TeamItem'; | |
import brazilMock from '../../fixtures/teams/brazil.json'; | |
const brazilTeam = humps.camelizeKeys(brazilMock); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { | |
StyleSheet, | |
Image, | |
View, | |
Text, | |
FlatList, | |
Dimensions, | |
} from 'react-native'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
import humps from 'humps'; | |
async function get(url) { | |
try { | |
const response = await axios.get(url); | |
return humps.camelizeKeys(response.data); | |
} catch ({ response }) { | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import renderer from 'react-test-renderer'; | |
import humps from 'humps'; | |
import TeamDetails from '../../../src/components/TeamDetails'; | |
import brazilMock from '../../fixtures/teams/brazil.json'; | |
const brazilTeam = humps.camelizeKeys(brazilMock); | |
describe('TeamDetails', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import { | |
StyleSheet, | |
Image, | |
View, | |
Text, | |
FlatList, | |
Dimensions, | |
} from 'react-native'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
async function get(url) { | |
try { | |
const response = await axios.get(url); | |
return response.data; | |
} catch ({ response }) { | |
return { | |
status: response.status, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import nock from 'nock'; | |
import httpRequest from '../../../src/services/httpRequest'; | |
import teamsListExpectedData from '../../fixtures/httpResponses/teamsList' | |
describe('httpRequest', () => { | |
describe('.get', () => { | |
it('returns the data from the http endpoint', async () => { | |
// given | |
nock('http://mock-api.com.br') |
NewerOlder