-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Envio do projeto com arquitetura base
- Loading branch information
1 parent
affd64a
commit a25bf46
Showing
53 changed files
with
2,747 additions
and
87 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
rootProject.name = 'GithubClient' | ||
include ':react-native-gesture-handler' | ||
project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android') | ||
|
||
include ':app' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import React from "react"; | ||
import { Provider } from "react-redux"; | ||
|
||
import Navigator from "./config/routes"; | ||
|
||
import store from "./config/store"; | ||
|
||
export default () => ( | ||
<Provider store={store}> | ||
<Navigator onNavigationStateChange={null} /> | ||
</Provider> | ||
); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import { | ||
POST_API_LOCATION_ADD, | ||
POST_API_LOCATION_ADD_SUCCESS, | ||
POST_API_LOCATION_ADD_ERROR, | ||
cleanResult, | ||
apiPostLocationAdd | ||
} from "../actions/apiLocationAdd"; | ||
import reducer from "../reducers/apiLocationAdd"; | ||
|
||
describe("actions locationAdd", () => { | ||
const request = { | ||
name: "Nome da Localização", | ||
address: "Endereço da Localização", | ||
phone: "(11) 12346-5432", | ||
type: "Tipo da Localização", | ||
lat: "10.2345", | ||
lng: "-10.2345", | ||
description: "Descrição da Localização" | ||
}; | ||
|
||
it("should clean locationAdd state", () => { | ||
const currentState = { | ||
isApiSubmiting: false, | ||
apiResultData: { | ||
id: 2331, | ||
createdBy: 9769, | ||
name: "Nome da Localização", | ||
address: "Endereço da Localização", | ||
phone: "(11) 12346-5432", | ||
type: "Tipo da Localização", | ||
lat: "10.2345", | ||
lng: "-10.2345", | ||
description: "Descrição da Localização" | ||
} | ||
}; | ||
|
||
const expectedAction = { | ||
isApiSubmiting: false, | ||
apiResultData: null | ||
}; | ||
|
||
expect(reducer(currentState, cleanResult())).toEqual(expectedAction); | ||
}); | ||
|
||
it("should create an action to add a location", () => { | ||
const expectedAction = { | ||
type: POST_API_LOCATION_ADD, | ||
location: request | ||
}; | ||
|
||
expect(apiPostLocationAdd(request)).toEqual(expectedAction); | ||
}); | ||
|
||
it("should start locationAdd API call", () => { | ||
const currentState = { | ||
isApiSubmiting: false, | ||
apiResultData: null | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
isApiSubmiting: true, | ||
apiResultData: null | ||
}; | ||
|
||
expect(reducer(currentState, apiPostLocationAdd(request))).toEqual( | ||
expectedAction | ||
); | ||
}); | ||
|
||
it("should return locationAdd API success", () => { | ||
const sagaSuccessResult = { | ||
id: 2331, | ||
createdBy: 9769, | ||
name: "Nome da Localização", | ||
address: "Endereço da Localização", | ||
phone: "(11) 12346-5432", | ||
type: "Tipo da Localização", | ||
lat: "10.2345", | ||
lng: "-10.2345", | ||
description: "Descrição da Localização" | ||
}; | ||
|
||
const currentState = { | ||
isApiSubmiting: true, | ||
apiResultData: null | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
isApiSubmiting: false, | ||
apiResultData: sagaSuccessResult | ||
}; | ||
|
||
expect( | ||
reducer(currentState, { | ||
type: POST_API_LOCATION_ADD_SUCCESS, | ||
sagaSuccessResult | ||
}) | ||
).toEqual(expectedAction); | ||
}); | ||
|
||
it("should return locationAdd API error", () => { | ||
const sagaErrors = { | ||
error: [ | ||
{ | ||
location: "body", | ||
param: "name", | ||
value: null, | ||
msg: "`Name` necessita ser do tipo string" | ||
} | ||
] | ||
}; | ||
|
||
const currentState = { | ||
isApiSubmiting: true, | ||
apiResultData: null | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
isApiSubmiting: false, | ||
apiResultData: sagaErrors | ||
}; | ||
|
||
expect( | ||
reducer(currentState, { type: POST_API_LOCATION_ADD_ERROR, sagaErrors }) | ||
).toEqual(expectedAction); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
import { | ||
GET_API_LOCATION_DETAILS, | ||
GET_API_LOCATION_DETAILS_SUCCESS, | ||
GET_API_LOCATION_DETAILS_ERROR, | ||
cleanResult, | ||
apiGetLocationDetails | ||
} from "../actions/apiLocationDetails"; | ||
import reducer from "../reducers/apiLocationDetails"; | ||
|
||
describe("actions locationDetails", () => { | ||
const idLocation = 1349; | ||
|
||
const apiResultData = { | ||
id: idLocation, | ||
createdBy: 9769, | ||
name: "Nome da Localização", | ||
address: "Endereço da Localização", | ||
phone: "(11) 12346-5432", | ||
type: "Tipo da Localização", | ||
lat: "10.2345", | ||
lng: "-10.2345", | ||
description: "Descrição da Localização" | ||
}; | ||
|
||
it("should clean locationDetails state", () => { | ||
const currentState = { | ||
isApiSubmiting: false, | ||
apiResultData | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
apiResultData: null | ||
}; | ||
|
||
expect(reducer(currentState, cleanResult())).toEqual(expectedAction); | ||
}); | ||
|
||
it("should create an action to get locationDetails", () => { | ||
const expectedAction = { | ||
type: GET_API_LOCATION_DETAILS, | ||
idLocation | ||
}; | ||
|
||
expect(apiGetLocationDetails(idLocation)).toEqual(expectedAction); | ||
}); | ||
|
||
it("should start locationDetails API call", () => { | ||
const currentState = { | ||
isApiSubmiting: false, | ||
apiResultData: null | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
isApiSubmiting: true | ||
}; | ||
|
||
expect(reducer(currentState, apiGetLocationDetails(idLocation))).toEqual( | ||
expectedAction | ||
); | ||
}); | ||
|
||
it("should return locationDetails API success", () => { | ||
const sagaSuccessResult = apiResultData; | ||
|
||
const currentState = { | ||
isApiSubmiting: true, | ||
apiResultData: null | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
isApiSubmiting: false, | ||
apiResultData: sagaSuccessResult | ||
}; | ||
|
||
expect( | ||
reducer(currentState, { | ||
type: GET_API_LOCATION_DETAILS_SUCCESS, | ||
sagaSuccessResult | ||
}) | ||
).toEqual(expectedAction); | ||
}); | ||
|
||
it("should return locationDetails API error", () => { | ||
const sagaErrors = { | ||
error: "Localização não foi econtrada." | ||
}; | ||
|
||
const currentState = { | ||
isApiSubmiting: true, | ||
apiResultData: null | ||
}; | ||
|
||
const expectedAction = { | ||
...currentState, | ||
isApiSubmiting: false, | ||
apiResultData: sagaErrors | ||
}; | ||
|
||
expect( | ||
reducer(currentState, { | ||
type: GET_API_LOCATION_DETAILS_ERROR, | ||
sagaErrors | ||
}) | ||
).toEqual(expectedAction); | ||
}); | ||
}); |
Oops, something went wrong.