File tree Expand file tree Collapse file tree 11 files changed +8370
-1654
lines changed
Expand file tree Collapse file tree 11 files changed +8370
-1654
lines changed Original file line number Diff line number Diff line change 11name : Publish Package
22
33on :
4- release :
5- types : [published]
4+ push :
5+ branches :
6+ - main
67
78jobs :
8- build :
9+ publish :
910 runs-on : ubuntu-latest
11+
1012 steps :
11- - uses : actions/checkout@v3
12- - uses : actions/setup-node@v3
13+ - uses : actions/checkout@v4
14+ with :
15+ token : ${{ secrets.GITHUB_TOKEN }}
16+
17+ - name : Setup node
18+ uses : actions/setup-node@v4
1319 with :
14- node-version : ' 16.x'
20+ node-version : " 18.x"
21+ cache : " npm"
1522 registry-url : https://registry.npmjs.org/
1623
17- - name : gitconfig
24+ - name : Configure git
1825 run : |
19- git config --global user.email "${{ github.actor}}@users.noreply.github.com "
20- git config --global user.name "${{ github.actor}} "
26+ git config user.name " github-actions[bot] "
27+ git config user.email " github-actions[bot]@users.noreply.github.com "
2128
22- - run : npm install
23- - run : npm version ${{ github.event.release.tag_name }}
24- - name : Create .env with github secrets and run script
25- run : |
26- touch .env
27- echo GITHUB_TOKEN=$GITHUB_TOKEN >> .env
28- echo NODE_AUTH_TOKEN=$NODE_AUTH_TOKEN >> .env
29- npm publish --access public
29+ - name : Install dependencies
30+ run : npm ci
31+
32+ - name : Run test
33+ run : npm run test
34+
35+ - name : Build
36+ run : npm run build
37+
38+ - name : Publish
39+ run : npm publish
3040 env :
3141 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
42+
43+ - name : Get package version
44+ id : package-version
45+ run : echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT
46+
47+ - name : Create release
48+ uses : actions/crete-release@v1
49+ env :
3250 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51+ with :
52+ tag_name : v${{ steps.package-version.outputs.version }}
53+ release_name : Release v${{ steps.package-version.outputs.version }}
54+ draft : false
55+ prerelease : false
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ All methods use promise meaning you can either use the `async...await` or `then.
6363- [ ] Disputes
6464- [x] Refunds
6565- [x] Verification
66- - [ ] Miscellaneous
66+ - [x ] Miscellaneous
6767
6868## CONTRIBUTING
6969
Original file line number Diff line number Diff line change 1+ import axios from "axios" ;
2+ import { Paystack } from "../src/paystack" ;
3+
4+ jest . mock ( 'axios' )
5+ const Axios = axios as jest . Mocked < typeof axios > ;
6+
7+ beforeEach ( ( ) => {
8+ Axios . create . mockReturnValue ( {
9+ interceptors : { response : { use : jest . fn ( ) } }
10+ } as any )
11+ } ) ;
12+
13+ describe ( 'PaystackSDK' , ( ) => {
14+ it ( 'sets correct headers on initialization' , ( ) => {
15+ new Paystack ( 'test-key' )
16+
17+ expect ( axios . create ) . toHaveBeenCalledWith ( {
18+ baseURL : 'https://api.paystack.co' ,
19+ headers : {
20+ Authorization : 'Bearer test-key' ,
21+ 'Content-Type' : 'application/json'
22+ }
23+ } )
24+ } )
25+ } )
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ preset : 'ts-jest' ,
3+ testEnvironment : 'node'
4+ }
You can’t perform that action at this time.
0 commit comments