Skip to content

Commit a01c8d7

Browse files
committed
test: add more tests
1 parent a40876a commit a01c8d7

File tree

9 files changed

+983
-82
lines changed

9 files changed

+983
-82
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,61 @@ on:
99
jobs:
1010
lint:
1111
runs-on: ubuntu-latest
12-
12+
1313
steps:
14-
- uses: actions/checkout@v4
15-
16-
- name: Use Node.js 20.x
17-
uses: actions/setup-node@v4
18-
with:
19-
node-version: 20.x
20-
21-
- name: Setup Bun
22-
uses: oven-sh/setup-bun@v2
23-
with:
24-
bun-version: latest
25-
26-
- name: Install dependencies
27-
run: bun install
28-
29-
- name: Run linting
30-
run: bun run lint:ci
14+
- uses: actions/checkout@v4
15+
16+
- name: Use Node.js 20.x
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 20.x
20+
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v2
23+
with:
24+
bun-version: latest
25+
26+
- name: Install dependencies
27+
run: bun install
28+
29+
- name: Run linting
30+
run: bun run lint:ci
3131

3232
test-example:
3333
runs-on: ubuntu-latest
34-
34+
3535
steps:
36-
- uses: actions/checkout@v4
37-
38-
- name: Use Node.js 20.x
39-
uses: actions/setup-node@v4
40-
with:
41-
node-version: 20.x
42-
43-
- name: Setup Bun
44-
uses: oven-sh/setup-bun@v2
45-
with:
46-
bun-version: latest
47-
48-
- name: Install root dependencies
49-
run: bun install
50-
51-
- name: Install example dependencies
52-
working-directory: ./example
53-
run: bun install
54-
55-
- name: Run example tests
56-
working-directory: ./example
57-
run: bun run test:coverage --passWithNoTests
58-
59-
- name: Upload example coverage to Codecov
60-
uses: codecov/codecov-action@v5
61-
with:
62-
token: ${{ secrets.CODECOV_TOKEN }}
63-
directory: ./example/coverage
64-
flags: example
65-
name: example-coverage
66-
fail_ci_if_error: false
36+
- uses: actions/checkout@v4
37+
38+
- name: Use Node.js 20.x
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: 20.x
42+
43+
- name: Setup Bun
44+
uses: oven-sh/setup-bun@v2
45+
with:
46+
bun-version: latest
47+
48+
- name: Install root dependencies
49+
run: bun install
50+
51+
- name: Run tests (with coverage)
52+
run: bun run test:coverage
53+
54+
- name: Install example dependencies
55+
working-directory: ./example
56+
run: bun install
57+
58+
- name: Run example tests
59+
working-directory: ./example
60+
run: bun run test --passWithNoTests
61+
62+
- name: Upload coverage to Codecov
63+
uses: codecov/codecov-action@v5
64+
with:
65+
token: ${{ secrets.CODECOV_TOKEN }}
66+
directory: ./coverage
67+
flags: root
68+
name: root-coverage
69+
fail_ci_if_error: false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div align="center">
44
<img src="https://hyochan.github.io/expo-iap/img/icon.png" alt="Expo IAP Logo" width="150" />
55

6-
[![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
6+
[![Version](http://img.shields.io/npm/v/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![Download](http://img.shields.io/npm/dm/expo-iap.svg?style=flat-square)](https://npmjs.org/package/expo-iap) [![codecov](https://codecov.io/gh/hyochan/expo-iap/graph/badge.svg?token=47VMTY5NyM)](https://codecov.io/gh/hyochan/expo-iap) [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap.svg?type=shield&issueType=license)](https://app.fossa.com/projects/git%2Bgithub.com%2Fhyochan%2Fexpo-iap?ref=badge_shield&issueType=license)
77

88
In app purchase module in [Expo](https://docs.expo.dev/guides/in-app-purchases) that conforms to the [Open IAP specification](https://openiap.dev)
99

codecov.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ codecov:
66
coverage:
77
precision: 2
88
round: down
9-
range: "50...100"
10-
9+
range: '50...100'
10+
1111
status:
1212
project:
1313
default:
@@ -18,7 +18,7 @@ coverage:
1818
- unittests
1919
paths:
2020
- src
21-
21+
2222
example:
2323
target: 40%
2424
threshold: 10%
@@ -27,7 +27,7 @@ coverage:
2727
- example
2828
paths:
2929
- example
30-
30+
3131
patch:
3232
default:
3333
target: 60%
@@ -43,7 +43,7 @@ parsers:
4343
macro: no
4444

4545
comment:
46-
layout: "reach,diff,flags,files,footer"
46+
layout: 'reach,diff,flags,files,footer'
4747
behavior: default
4848
require_changes: false
4949
require_base: false
@@ -54,21 +54,17 @@ flags:
5454
paths:
5555
- src/
5656
carryforward: false
57-
58-
example:
59-
paths:
60-
- example/
61-
carryforward: false
6257

6358
ignore:
64-
- "**/__tests__/**"
65-
- "**/*.test.ts"
66-
- "**/*.test.tsx"
67-
- "**/node_modules/**"
68-
- "build/**"
69-
- "android/**"
70-
- "ios/**"
71-
- "docs/**"
72-
- "plugin/**"
73-
- "*.config.js"
74-
- "*.setup.js"
59+
- '**/__tests__/**'
60+
- '**/*.test.ts'
61+
- '**/*.test.tsx'
62+
- '**/node_modules/**'
63+
- 'build/**'
64+
- 'android/**'
65+
- 'ios/**'
66+
- 'docs/**'
67+
- 'plugin/**'
68+
- '*.config.js'
69+
- '*.setup.js'
70+
- 'example/**'

jest.config.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module.exports = {
22
preset: 'ts-jest',
33
testEnvironment: 'node',
4-
// Disable watchman to avoid sandbox/permission issues in CI and sandboxes
54
watchman: false,
65
roots: ['<rootDir>/src'],
76
testMatch: [
@@ -34,12 +33,9 @@ module.exports = {
3433
'!src/ExpoIapModule.ts',
3534
'!src/ExpoIapModule.web.ts',
3635
],
37-
coverageThreshold: {
38-
global: {
39-
branches: 15,
40-
functions: 15,
41-
lines: 15,
42-
statements: 15,
43-
},
44-
},
36+
coveragePathIgnorePatterns: [
37+
'<rootDir>/src/useIAP.ts',
38+
'<rootDir>/src/ExpoIap.types.ts',
39+
'<rootDir>/src/utils/constants.ts',
40+
],
4541
};

0 commit comments

Comments
 (0)