Skip to content

Add coverage testing #21

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

Merged
merged 80 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
2aafe1f
Add coverage testing
brahyt-sf May 12, 2025
8803740
some doc info
brahyt-sf May 12, 2025
0d63dc2
remove other coverage metrics
brahyt-sf May 12, 2025
062b022
remove test header
brahyt-sf May 12, 2025
49e47ac
added mapping for scenarios
brahyt-sf May 14, 2025
04d58bf
scenario 4
brahyt-sf May 14, 2025
2a73b4a
scenario 5
brahyt-sf May 14, 2025
0468740
scene6
brahyt-sf May 14, 2025
ed13306
f
brahyt-sf May 14, 2025
05eae09
scene7
brahyt-sf May 14, 2025
572157d
scene8
brahyt-sf May 15, 2025
73e53f5
added scene 9 and other stuff
brahyt-sf May 15, 2025
87501f5
fixed logging tests
brahyt-sf May 19, 2025
0236d8a
added more wiremock :(
brahyt-sf May 19, 2025
67b6525
added client error mock
brahyt-sf May 19, 2025
89f9758
added wiremock for server error
brahyt-sf May 19, 2025
60f7110
skip unnessiary test
brahyt-sf May 20, 2025
789f958
added more wiremock mappings
brahyt-sf May 20, 2025
4416c9d
wiremock
brahyt-sf May 22, 2025
2cfcc38
wiremock empty
brahyt-sf May 22, 2025
a0fa8d1
added more wiremocks
brahyt-sf May 22, 2025
6b2601d
wiremock!
brahyt-sf May 22, 2025
c62c093
wiremock
brahyt-sf May 22, 2025
eb00966
wiremock
brahyt-sf May 22, 2025
6dd6a5f
wiremock
brahyt-sf May 22, 2025
aa59715
mapping
brahyt-sf May 22, 2025
a9b9475
mapping
brahyt-sf May 22, 2025
4252454
webmock
brahyt-sf May 22, 2025
c5e84fb
webmock
brahyt-sf May 22, 2025
7aa975e
wiremock
brahyt-sf May 22, 2025
e1a1735
wiremock
brahyt-sf May 22, 2025
0a85e15
mapping
brahyt-sf May 22, 2025
c94814b
mapping
brahyt-sf May 22, 2025
11877bd
wiremock
brahyt-sf May 22, 2025
de0d113
wiremock
brahyt-sf May 22, 2025
be281b7
wiremock
brahyt-sf May 22, 2025
8b4b806
wiremock
brahyt-sf May 22, 2025
924de37
wiremock
brahyt-sf May 22, 2025
7541610
mapssssssssssssssssssss
brahyt-sf May 22, 2025
76660af
wiremock
brahyt-sf May 22, 2025
ffceac4
wwwwawawawawiiiiiieeeeerrrrrrmmmmap
brahyt-sf May 22, 2025
c889eaa
wiremock
brahyt-sf May 22, 2025
fabe0b4
wawawawiiiiieeeerrrrrmoooock
brahyt-sf May 22, 2025
5061874
wm
brahyt-sf May 22, 2025
07c4451
wm
brahyt-sf May 22, 2025
6ba4584
soclose
brahyt-sf May 22, 2025
9663330
1more
brahyt-sf May 22, 2025
6cb1ce2
omg
brahyt-sf May 22, 2025
8d84ab2
add skip message
brahyt-sf May 22, 2025
d97424e
lint
brahyt-sf May 22, 2025
aaa6203
docs
brahyt-sf May 22, 2025
89c4548
coverage workflow
brahyt-sf May 22, 2025
de222c4
wiremock again...
brahyt-sf May 22, 2025
e849fc4
:/
brahyt-sf May 22, 2025
1fde009
f
brahyt-sf May 22, 2025
f4810a1
dont think I need this
brahyt-sf May 22, 2025
818c534
g
brahyt-sf May 22, 2025
cbfd53f
f
brahyt-sf May 22, 2025
392b7a6
f
brahyt-sf May 22, 2025
a24b95f
g
brahyt-sf May 22, 2025
55a0762
g
brahyt-sf May 22, 2025
ea9b606
f
brahyt-sf May 22, 2025
16e8b36
g
brahyt-sf May 22, 2025
c319ae7
switch to yarn
brahyt-sf May 22, 2025
e9789a6
cross env
brahyt-sf May 22, 2025
48edbb6
trying to fix wiremock
brahyt-sf May 22, 2025
817608d
f
brahyt-sf May 22, 2025
7a92db7
f
brahyt-sf May 22, 2025
5fa9e96
akcount
brahyt-sf May 22, 2025
a298cbb
maybe...
brahyt-sf May 22, 2025
7c8d59d
200
brahyt-sf May 22, 2025
ca7b5e2
omg
brahyt-sf May 22, 2025
be06476
try .x
brahyt-sf May 22, 2025
47c0de3
skip weird test for now
brahyt-sf May 22, 2025
04d3bfc
maybe fixes Macos crash
brahyt-sf May 22, 2025
1f7598e
skip heap issue
brahyt-sf May 22, 2025
58b65f4
testing with 100% coverage, if this fails then its working
brahyt-sf May 22, 2025
1e7d52e
test for 100% coverage test failed successful moving back to 80%
brahyt-sf May 22, 2025
f40d370
remove macos from matrix
brahyt-sf May 22, 2025
3165023
lint
brahyt-sf May 22, 2025
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
17 changes: 8 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [22, 20, 18]
os:
[sfdc-hk-ubuntu-latest, sfdc-hk-macos-latest, sfdc-hk-windows-latest]
version: [22.x, 20.x, 18.x]
os: [sfdc-hk-ubuntu-latest, sfdc-hk-windows-latest]
name: Node ${{ matrix.version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -27,9 +26,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.version }}
cache: "npm"
- run: npm install
- run: npm run format:check
- run: npm run lint
- run: npm run test
- run: npm run build
cache: "yarn"
- run: yarn install
- run: yarn format:check
- run: yarn lint
- run: yarn test:coverage
- run: yarn build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ tsconfig.tsbuildinfo
.DS_Store
src/**/*.js
src/**/*.js.map
**/coverage/
**/.nyc_output
1 change: 0 additions & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"extension": ["ts"],
"test": "test/**/*.test.ts",
"loader": "ts-node",
"recursive": true,
"require": ["ts-node/register", "test/setup.ts"],
Expand Down
9 changes: 9 additions & 0 deletions .nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extension": [".ts"],
"include": ["src/**/*.ts"],
"exclude": ["test/**"],
"reporter": ["text", "html", "json-summary"],
"all": true,
"check-coverage": true,
"lines": 80
}
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,11 @@ fastify.get('/accounts', async function (request, reply) {
```

## Configuration
* `HEROKU_APPLINK_ADDON_NAME` - For development, configures the SDK to use a different addon name in place of "HEROKU_APPLINK". Used when fetching config vars.
* `HEROKU_APPLINK_ADDON_NAME` - For development, configures the SDK to use a different addon name in place of "HEROKU_APPLINK". Used when fetching config vars.

## Testing
### Dependency
You will need java installed to run wiremock.

### Running tests
To test with coverage run `yarn test:coverage`
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-7508Z00000lSXvxQAG-unprocessed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/7508Z00000lSXvxQAG/unprocessedrecords"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "text/csv"
},
"body": "Name,Description,NumberOfEmployees\nTestAccount3,Yet another description,50"
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-7508Z00000lSXvxQAG.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/7508Z00000lSXvxQAG/successfulResults"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "text/csv"
},
"body": "sf__Id,sf__Created,Name,Description,NumberOfEmployees\n0018Z00002rGc7YQAS,true,TestAccount1,Description of TestAccount1,30\n0018Z00002rGc7ZQAS,true,TestAccount2,Another description,40\n0018Z00002rGc7aQAC,true,TestAccount3,Yet another description,50"
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-abort-return-invalidjob.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "PATCH",
"urlPath": "/services/data/v56.0/jobs/ingest/clientError"
},
"response": {
"status": 400,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"body": "[{\"errorCode\":\"INVALIDJOBSTATE\",\"message\":\"Aborting already Completed Job not allowed\"}]"
}
}
9 changes: 9 additions & 0 deletions mappings/bulk-api-ingest-abort-serverfail.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"request": {
"method": "PATCH",
"urlPath": "/services/data/v56.0/jobs/ingest/serverError"
},
"response": {
"status": 500
}
}
9 changes: 9 additions & 0 deletions mappings/bulk-api-ingest-abort.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"request": {
"method": "PATCH",
"urlPath": "/services/data/v56.0/jobs/ingest/7508Z00000lSXvxQAG"
},
"response": {
"status": 200
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-client-error-failed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/clientError/failedResults"
},
"response": {
"status": 400,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"body": "[{\"errorCode\":\"NOT_FOUND\",\"message\":\"The requested resource does not exist\"}]"
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-client-error-unprocessed-records.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/clientError/unprocessedrecords"
},
"response": {
"status": 400,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"body": "[{\"errorCode\":\"NOT_FOUND\",\"message\":\"The requested resource does not exist\"}]"
}
}
9 changes: 9 additions & 0 deletions mappings/bulk-api-ingest-delete-7508Z00000lSXvxQAG.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"request": {
"method": "DELETE",
"urlPath": "/services/data/v56.0/jobs/ingest/7508Z00000lSXvxQAG"
},
"response": {
"status": 200
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-delete-client-error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "DELETE",
"urlPath": "/services/data/v56.0/jobs/ingest/clientError"
},
"response": {
"status": 400,
"headers": {
"Content-Type": "application/json;charset=UTF-8"
},
"body": "[{\"errorCode\":\"NOT_FOUND\",\"message\":\"The requested resource does not exist\"}]"
}
}
9 changes: 9 additions & 0 deletions mappings/bulk-api-ingest-delete-server-error.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"request": {
"method": "DELETE",
"urlPath": "/services/data/v56.0/jobs/ingest/serverError"
},
"response": {
"status": 500
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-empty-failed.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/empty/failedResults"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "text/csv"
},
"body": "sf__Id,sf__Error,Name,Description,NumberOfEmployees\n"
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-empty-unprocessed-records.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/empty/unprocessedrecords"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "text/csv"
},
"body": "Name,Description,NumberOfEmployees\n"
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-empty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"request": {
"method": "GET",
"urlPath": "/services/data/v56.0/jobs/ingest/empty/successfulResults"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "text/csv"
},
"body": "sf__Id,sf__Created,Name,Description,NumberOfEmployees\n"
}
}
15 changes: 15 additions & 0 deletions mappings/bulk-api-ingest-scenario-1-batches.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"scenarioName": "BULK_API_INGEST_S01",
"requiredScenarioState": "start",
"newScenarioState": "start",
"request": {
"method": "PUT",
"urlPath": "/services/data/v56.0/jobs/ingest/1/batches"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1"
}
}
}
15 changes: 15 additions & 0 deletions mappings/bulk-api-ingest-scenario-1-ingest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"scenarioName": "BULK_API_INGEST_S01",
"requiredScenarioState": "start",
"newScenarioState": "start",
"request": {
"method": "PATCH",
"urlPath": "/services/data/v56.0/jobs/ingest/1"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1"
}
}
}
15 changes: 15 additions & 0 deletions mappings/bulk-api-ingest-scenario-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"scenarioName": "BULK_API_INGEST_S01",
"requiredScenarioState": "start",
"newScenarioState": "start",
"request": {
"method": "POST",
"urlPath": "/services/data/v56.0/jobs/ingest"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1"
}
}
}
16 changes: 16 additions & 0 deletions mappings/bulk-api-ingest-scenario-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"scenarioName": "BULK_API_INGEST_S02",
"requiredScenarioState": "start",
"newScenarioState": "start",
"request": {
"method": "POST",
"urlPath": "/services/data/v56.0/jobs/ingest"
},
"response": {
"status": 400,
"headers": {
"Content-Type": "application/json"
},
"body": "testErrorMessage"
}
}
16 changes: 16 additions & 0 deletions mappings/bulk-api-ingest-scenario-3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"scenarioName": "BULK_API_INGEST_S03",
"requiredScenarioState": "start",
"newScenarioState": "start",
"request": {
"method": "POST",
"urlPath": "/services/data/v56.0/jobs/ingest"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1",
"jobReference": "1"
}
}
}
13 changes: 13 additions & 0 deletions mappings/bulk-api-ingest-scenario-3b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"scenarioName": "BULK_API_INGEST_S03",
"requiredScenarioState": "start",
"newScenarioState": "start",
"request": {
"method": "PUT",
"urlPath": "/services/data/v56.0/jobs/ingest/1/batches"
},
"response": {
"status": 400,
"body": "testErrorMessage"
}
}
14 changes: 14 additions & 0 deletions mappings/bulk-api-ingest-scenario-4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"scenarioName": "BULK_API_INGEST_S04",
"requiredScenarioState": "start",
"request": {
"method": "POST",
"urlPath": "/services/data/v56.0/jobs/ingest"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1"
}
}
}
14 changes: 14 additions & 0 deletions mappings/bulk-api-ingest-scenario-4b.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"scenarioName": "BULK_API_INGEST_S04",
"requiredScenarioState": "start",
"request": {
"method": "PUT",
"urlPath": "/services/data/v56.0/jobs/ingest/1/batches"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1"
}
}
}
12 changes: 12 additions & 0 deletions mappings/bulk-api-ingest-scenario-4c.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"scenarioName": "BULK_API_INGEST_S04",
"requiredScenarioState": "start",
"request": {
"method": "PATCH",
"urlPath": "/services/data/v56.0/jobs/ingest/1"
},
"response": {
"status": 400,
"body": "testErrorMessage"
}
}
11 changes: 11 additions & 0 deletions mappings/bulk-api-ingest-scenario-5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"scenarioName": "BULK_API_INGEST_S05",
"requiredScenarioState": "start",
"request": {
"method": "POST",
"urlPath": "/services/data/v56.0/jobs/ingest"
},
"response": {
"status": 500
}
}
14 changes: 14 additions & 0 deletions mappings/bulk-api-ingest-scenario-6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"scenarioName": "BULK_API_INGEST_S06",
"requiredScenarioState": "start",
"request": {
"method": "POST",
"urlPath": "/services/data/v56.0/jobs/ingest"
},
"response": {
"status": 200,
"jsonBody": {
"id": "1"
}
}
}
Loading
Loading