Skip to content

Commit

Permalink
Merge pull request #56 from esatya/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
myanzik authored Dec 30, 2021
2 parents e475b22 + 90cf49b commit ab93e77
Show file tree
Hide file tree
Showing 11 changed files with 192 additions and 165 deletions.
93 changes: 0 additions & 93 deletions CODE_OF_CONDUCT

This file was deleted.

6 changes: 6 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Code of Conduct
We are a community of contributors - developers, volunteers, researchers, and humanitarian agencies from all over the world. We create an environment where our community can effectively explore, create innovative and open aid distribution technology services that are inclusive, accountable, and accessible for everyone.

Diversity is one of our huge strengths, but it can also lead to communication issues and unhappiness. To that end, we have a few ground rules that we ask people to adhere to. This code of conduct applies to all spaces managed by Rahat to all the contributors.

For a detailed code of conduct, please see our [Rahat:Code of Conduct](https://docs.rahat.io/docs/next/code-of-conduct/).
51 changes: 3 additions & 48 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,5 @@
**Namaste**, Rahat development team would like to thank you for taking the time to contribute! We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features
- Becoming a maintainer
- Getting involved with Rahat community
Rahat platform is an open-source project working to create an environment where our community can effectively explore, create innovative and open aid distribution technology services that are inclusive, accountable, and accessible for everyone.

We have created guidelines for contributing to Rahat project and packages. These are guidelines, not rules. We encourage you to use your best judgment, and feel free to recommend changes to this document in a pull request. We use github to host code, to track issues and feature requests, as well as accept pull requests.
# How to contribute to the Rahat Project?
This section guides you through submitting a bug report for Rahat. Following these guidelines helps maintainers and the community understand your report, reproduce the behavior, and find related reports
You can submit a bug report or any suggestions on this project through github issues.
When you are creating a bug report, please include as many details as possible. Fill out the required template, the information it asks for helps us resolve issues faster.
The best way to contribute to this project is by making a pull request in following ways
- Fork the Rahat project and work on your fork
- Create a new branch on which you want to make changes - “git checkout -b ‘my-contribution’ ” or push your changes on develop branch
- Please make one pull request per issue to avoid large merges.
- Commit your change with a commit message describing the correction.
- Submit a pull request against the Rahat repository.
In general, all pull requests must:
- Have a clear use case, fix a demonstrable bug or serve the greater good of the project
- Have unit tests, functional tests, and fuzz tests, where appropriate;
- Follow code style guidelines
- Not break the existing test suite;
- Where bugs are fixed, where possible, there should be unit tests demonstrating the bug and also proving the fix. This helps prevent regression.
- Change relevant comments and documentation when the behavior of code changes.
## Contributing with an issue
If you find any bug and you're not sure how to fix it, or you don't know how to do a pull request, then you can create an Issue. Filing an Issue will help us see the problem and fix it.
Issues in Rahat’s[ ](https://github.com/orgs/esatya)[Github repositories](https://github.com/orgs/esatya) are the primary means by which bug reports, feedback, and general discussions are made. A contributor is invited to create an issue, discuss it, and provide a fix if needed.
- [https://github.com/esatya/rahat-vendor](https://github.com/esatya/rahat-vendor)
## Reporting Bugs
This section guides you through submitting a bug report for Rahat. Following these guidelines helps maintainers and the community understand your report 📝, reproduce the behavior 💻 💻, and find related reports 🔎.
Before creating bug reports, please check [this list](https://github.com/orgs/esatya/projects/2) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](https://github.com/atom/atom/blob/master/CONTRIBUTING.md#how-do-i-submit-a-good-bug-report).
Note: If you find a Closed issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.
#### **How Do I Submit A (Good) Bug Report?**
Bugs are tracked as GitHub issues. After you've determined [which repository](https://github.com/atom/atom/blob/master/CONTRIBUTING.md#atom-and-packages) your bug is related to, create an issue on that repository and provide the following information.
## Contribute beyond coding...
You can share your skills and insights to support the Rahat community grow .
### For Feedbacks and Insights
If you have expertise and experience in cash transfer and want to share your insights and feedback with the community at [support@rahat.io](mailto:suport@rahat.io) or connect with us [\[t\]](https://twitter.com/rahataid) [\[d\] ](https://discord.gg/p2kxaP2m8t)
### For Documentation
We share our journey - and the lessons we learned on the way through reports, case studies, articles, blogs, and surveys. Contact us if you want to contribute and learn more 👉 [support@rahat.io](mailto:suport@rahat.io) or connect with us [\[t\]](https://twitter.com/rahataid) [\[d\] ](https://discord.gg/p2kxaP2m8t)
### For Designs
If you are interested in creating and designing in UI/UX, animations, photos, infographics, IEC materials, tutorials, and explainers for the Rahat community -- feel free to contact us with any design-related questions 👉 [support@rahat.io ](mailto:suport@rahat.io)or connect with us [\[t\]](https://twitter.com/rahataid) [\[d\] ](https://discord.gg/p2kxaP2m8t)
# Style Guide
This repository uses [eslint ](https://github.com/eslint/eslint)to enforce [air-bnb coding styles](https://github.com/airbnb/javascript).
## Connect with Rahat Contributors
If you want to connect with our contributors, you can connect us at [![Join the chat at https://gitter.im/bockies/community](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bockies/community?utm_source=badge&utm_medium=badge&utm_content=badge)
If you want to contribute to Rahat, there are a few things you need to know.

Last updated : 11/15/2021
We have a [contributing guide](https://docs.rahat.io/docs/next/contribution-guidelines) to help you get started.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ To deploy this software on production
This repository uses eslint to enforce air-bnb coding styles.

# Contributing
Everyone is very welcome to contribute on the codebase of Rahat. Please reach us in Gitter in case of any query/feedback/suggestion.
Everyone is very welcome to contribute on the codebase of Rahat. Please reach us in [Gitter](https://gitter.im/bockies/community?utm_source=badge&utm_medium=badge&utm_content=badge) in case of any query/feedback/suggestion.

For more information on the contributing procedure, see [Contribution](https://github.com/esatya/rahat-documentation/blob/main/CONTRIBUTING.md).
For more information on the contributing procedure, see [Contribution](https://github.com/esatya/rahat-vendor/blob/master/CONTRIBUTING.md).
7 changes: 6 additions & 1 deletion src/services/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,18 @@ const DataService = {

async getAssetBySymbol(symbol, network) {
if (!network) return db.assets.get({ symbol });
if (symbol.toUpperCase() === 'ETH') return db.assets.get({ symbol });
return db.assets.filter(a => a.symbol === symbol && a.network && a.network.name === network).first();
},

async addDefaultAsset(symbol, name) {
let asset = await this.getAsset('default');
if (!asset) return db.assets.add({ address: 'default', symbol, name, decimal: 18, balance: 0 });
asset = {
...asset,
symbol,
name
};
return this.updateAsset(asset.address, asset);
},

async addMultiAssets(assets) {
Expand Down
1 change: 0 additions & 1 deletion src/services/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export async function registerToAgency(payload) {

export async function getPackageDetails(id) {
try {
if (!id) throw new Error('Must send id');
const res = await axios.get(`${API.NFT}/token/${id}`);
return res.data;
} catch (e) {
Expand Down
9 changes: 6 additions & 3 deletions src/utils/blockchain/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ const Wallet = {

async loadFromPrivateKey(privateKey) {
if (!privateKey) return null;
let wallet = new ethers.Wallet(privateKey);
if (!wallet) throw Error('Wallet not found');
return this.connectProvider(wallet);
try {
let wallet = new ethers.Wallet(privateKey);
return this.connectProvider(wallet);
} catch (e) {
throw e;
}
}
};

Expand Down
26 changes: 26 additions & 0 deletions tests/apiTests/service.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ describe('API calls', () => {
expect(axios.get).toHaveBeenCalled();
expect(axios.get).toHaveBeenCalledWith(`${api.NFT}/token/${tokenId}`);
});
it('Handles error on Getting Package Details', async () => {
axios.get.mockRejectedValue({});
try {
await API_CALLS.getPackageDetails();
} catch (e) {
expect(e).toBeDefined();
}
});

it('Registers to Agency', async () => {
const payload = {
Expand All @@ -72,6 +80,16 @@ describe('API calls', () => {
'Content-Type': 'application/json'
}
});

axios.post.mockRejectedValue({});
try {
await API_CALLS.registerToAgency(payload);
} catch (e) {
console.log({ e });
expect(e).toBeDefined();
}

// expect(axios.post).toThrow();
});
it('Checks for Approval Correctly', async () => {
const walletAddress = '981c21250604365793d43080fa303De29D1bcF42';
Expand All @@ -87,4 +105,12 @@ describe('API calls', () => {
expect(axios.get).toHaveBeenCalled();
expect(axios.get).toHaveBeenCalledWith(`${api.SERVER_URL}/vendors/0x${walletAddress}`);
});
it('Handls error on Checks for Approval', async () => {
axios.get.mockRejectedValue({});
try {
await API_CALLS.checkApproval();
} catch (e) {
expect(e).toBeDefined();
}
});
});
Loading

0 comments on commit ab93e77

Please sign in to comment.