Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage #38

Merged
merged 42 commits into from
Dec 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
f8db755
fixed selfie capture
myanzik Nov 19, 2021
ab669d1
Merge pull request #22 from myanzik/stage
myanzik Nov 19, 2021
92cde2e
Merge remote-tracking branch 'upstream/stage' into stage
Nov 22, 2021
58fe061
comply changes with updated rahat-contracts
myanzik Nov 22, 2021
b044ca6
Merge pull request #23 from myanzik/nft-support
myanzik Nov 22, 2021
616fa3a
Merge remote-tracking branch 'upstream/stage' into stage
Nov 22, 2021
dd7ec88
Asset UI design integrated
Rojan10 Nov 22, 2021
e49c1aa
Merge pull request #24 from rojanbade/vendor-ui
myanzik Nov 22, 2021
35de1a9
package list and details
myanzik Nov 23, 2021
8f8a2a9
Merge pull request #25 from myanzik/nft-charge
myanzik Nov 23, 2021
3150def
package details
myanzik Nov 23, 2021
2067a83
Merge pull request #26 from myanzik/nft-charge
myanzik Nov 23, 2021
af0e7ed
Merge remote-tracking branch 'upstream/stage' into stage
Nov 23, 2021
abae10a
package-charge
Nov 23, 2021
ad17f0c
created charge context, not finished yet
Nov 24, 2021
6dcaede
reworked charge module and its coreesponding routes,created Charge co…
Nov 24, 2021
351e214
NFT charge success now stores NFT details in index db
Nov 25, 2021
06707c3
updated Rahat domain
nishu-rumsan Nov 25, 2021
b59a60f
Added coding style and contributing
nishu-rumsan Nov 25, 2021
34e8dc4
removed id
nishu-rumsan Nov 25, 2021
c9f4ab8
Merge pull request #27 from Rasil07/package-charge
myanzik Nov 26, 2021
abdf2ca
User assets shows saved NFTS
Nov 26, 2021
ae09b97
Merge pull request #28 from Nishubade/stage
myanzik Nov 26, 2021
01f9f15
Merge pull request #29 from Rasil07/assets
myanzik Nov 26, 2021
9ccd81c
reworked contract service call for fetching beneficiary tokenids and …
Nov 30, 2021
78e06f3
changed UI of recent transaction component
Nov 30, 2021
61aa6fe
Merge pull request #31 from Rasil07/package-list-rework
myanzik Nov 30, 2021
3c4e251
Jest setup
Rojan10 Dec 1, 2021
269f940
removed unwanted variables, added necessary packages and configuratio…
Dec 1, 2021
ddc9465
wrote tests for appReducer
Dec 2, 2021
5e5c04c
wrote tests for service calls
Dec 3, 2021
7333646
Merge pull request #32 from rojanbade/vendor-ui
myanzik Dec 3, 2021
89bc88f
merged conflicts
Dec 6, 2021
51890a8
Merge pull request #34 from Rasil07/jest-init
myanzik Dec 6, 2021
599499d
coveralls-setup
myanzik Dec 6, 2021
293b3c0
Merge pull request #35 from myanzik/coveralls-setup
myanzik Dec 6, 2021
746f566
coveralls fix
myanzik Dec 6, 2021
c7b4203
Merge pull request #36 from myanzik/coveralls-setup
myanzik Dec 6, 2021
bbcb0b6
coverall fix
myanzik Dec 6, 2021
ffe42ce
CI test on master
myanzik Dec 6, 2021
13d1df1
Merge pull request #37 from myanzik/coveralls-setup
myanzik Dec 6, 2021
4fe4dae
Merge branch 'master' into stage
myanzik Dec 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Coveralls CI/CD
on:
push:
branches:
- stage
- master
pull_request:
branches:
- stage
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install

coverage:
name: Coveralls
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn run test
- uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ sandbox/
config/
public/js/app
yarn.lock
coverage/

# Logs
logs
Expand Down Expand Up @@ -64,4 +65,4 @@ typings/
# dotenv environment variables file
.env
play/
build/
build/
22 changes: 11 additions & 11 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": true,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "auto"
}
{
"printWidth": 120,
"tabWidth": 4,
"useTabs": true,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "lf"
}
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-react']
};
183 changes: 183 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,

// Stop running tests after `n` failures
bail: 1,
verbose: true,

// Respect "browser" field in package.json when resolving modules
// browser: false,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/v8/7jznytm51515npdjlt72gd9m0000gn/T/jest_dx",

// Automatically clear mock calls and instances between every test
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: true,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: ['src/app/**/*.js'],

// The directory where Jest should output its coverage files
coverageDirectory: './coverage',

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ['text', 'lcov'],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: null,

// A path to a custom dependency extractor
// dependencyExtractor: null,

// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,

// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: null,

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: null,

// A set of global variables that need to be available in all test environments
globals: {
REACT_APP_DEFAULT_AGENCY_API: 'https://agency-nft.rahat.io/api/v1'
},

// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "ts",
// "tsx",
// "node"
// ],

// A map from regular expressions to module names that allow to stub out resources with a single module
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],

// Activates notifications for test results
// notify: false,

// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
preset: 'ts-jest',

// Run tests from one or more projects
// projects: null,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,

// Automatically reset mock state between every test
// resetMocks: false,

// Reset the module registry before running each individual test
// resetModules: false,

// A path to a custom resolver
// resolver: null,

// Automatically restore mock state between every test
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: null,

// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],

// The test environment that will be used for testing
// testEnvironment: 'node',

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
testMatch: ['**/tests/**/*.test.js', '**/tests/**/*.spec.js'],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],

// This option allows the use of a custom results processor
// testResultsProcessor: null,

// This option allows use of a custom test runner
// testRunner: "jasmine2",

// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",

// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",

// A map from regular expressions to paths to transformers
transform: {
'^.+\\.(ts|tsx)?$': 'ts-jest',
'^.+\\.(js|jsx)$': 'babel-jest'
}

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/"
// ],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: null,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
};
1 change: 1 addition & 0 deletions jest/setEnvVars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process.env.REACT_APP_DEFAULT_AGENCY_API = 'https://agency-nft.rahat.io/api/v1';
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,26 @@
"workbox-streams": "^5.1.3"
},
"devDependencies": {
"@babel/preset-env": "^7.16.4",
"@babel/preset-react": "^7.16.0",
"babel-jest": "^27.4.2",
"coveralls": "^3.1.1",
"enzyme": "^3.11.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"prettier": "^2.3.0"
"jest": "^27.4.2",
"prettier": "^2.3.0",
"react-test-renderer": "^17.0.2",
"ts-jest": "^27.0.7"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
"eject": "react-scripts eject",
"test": "jest --coverage",
"send-coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls"
},
"eslintConfig": {
"extends": [
Expand Down
54 changes: 27 additions & 27 deletions src/actionsheets/Charge.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import React, { useState, useEffect, useContext, useCallback } from 'react';
import { ChargeDetails, OTP, QrcodeReader } from './sheets';
import { ActionSheetContext } from '../contexts/ActionSheetContext';

export default function ChargeAction(props) {
const { initData, showLoading, setData, activeSheet, setActiveSheet } = useContext(ActionSheetContext);

let init = useCallback(async () => {
initData({ phone: '', amount: '', otp: '', chargeTxHash: null });
}, [initData]);

const onHide = () => {
setData({ phone: '', amount: '', otp: '', chargeTxHash: null });
setActiveSheet(null);
showLoading(null);
};

useEffect(init, []);

return (
<>
<QrcodeReader onHide={onHide} showModal={activeSheet === 'qrcode-reader'} />
<ChargeDetails onHide={onHide} showModal={activeSheet === 'charge-details'} />
<OTP onHide={onHide} showModal={activeSheet === 'otp'} />
</>
);
}
import React, { useEffect, useContext, useCallback } from 'react';
import { ChargeDetails, OTP, QrcodeReader } from './sheets';
import { ActionSheetContext } from '../contexts/ActionSheetContext';
export default function ChargeAction(props) {
const { initData, showLoading, setData, activeSheet, setActiveSheet } = useContext(ActionSheetContext);
let init = useCallback(async () => {
initData({ phone: '', amount: '', otp: '', chargeTxHash: null });
}, [initData]);
const onHide = () => {
setData({ phone: '', amount: '', otp: '', chargeTxHash: null });
setActiveSheet(null);
showLoading(null);
};
//eslint-disable-next-line
useEffect(init, []);
return (
<>
<QrcodeReader onHide={onHide} showModal={activeSheet === 'qrcode-reader'} />
<ChargeDetails onHide={onHide} showModal={activeSheet === 'charge-details'} />
<OTP onHide={onHide} showModal={activeSheet === 'otp'} />
</>
);
}
9 changes: 5 additions & 4 deletions src/actionsheets/sheets/ChargeDetails.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@

import { useContext } from 'react';
import { useHistory } from 'react-router-dom';
import { Form } from 'react-bootstrap';
import Swal from 'sweetalert2';

import DataService from '../../services/db';
import { RahatService } from '../../services/chain';
import { AppContext } from '../../contexts/AppContext';
// import DataService from '../../services/db';
// import { RahatService } from '../../services/chain';
// import { AppContext } from '../../contexts/AppContext';
import { ActionSheetContext } from '../../contexts/ActionSheetContext';
import ActionSheet from './ActionSheet';

Expand All @@ -14,7 +15,7 @@ export default function ChargeDetails(props) {
const { onHide, showModal } = props;

const { showLoading, data, setData, setActiveSheet } = useContext(ActionSheetContext);
const { wallet } = useContext(AppContext);
// const { wallet } = useContext(AppContext);

const chargeCustomer = async () => {
showLoading('Charging customer account...');
Expand Down
5 changes: 3 additions & 2 deletions src/modules/charge/package/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ export default function ChargePackage(props) {

useEffect(() => {
(async () => {
const agency = await DataService.getDefaultAgency();
const rahat = RahatService(agency.address, wallet);
// const agency = await DataService.getDefaultAgency();
// const rahat = RahatService(agency.address, wallet);

const data = await getPackageDetails(tokenId);

setPkg({
Expand Down
Loading