Skip to content

Commit

Permalink
Add MockStatusReporter to library
Browse files Browse the repository at this point in the history
  • Loading branch information
numtel committed Sep 26, 2024
1 parent d3a4d5f commit c4e7fb2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Function Name | Arguments | Note
`async zipDirectory` | <ul><li>`sourceDir` (string)</li><li>`outPath` (string)</li><li>`logger` (object, optional)</li></ul> | Create a zip file of a directory. If specified, `logger` must have a `log(msg)` method.
`mkdirpSync` | `targetDir` (string) | Recreation of shell command `mkdir -p`
`async deleteS3Keys` | `keys` (Array[string]) | Delete some files in the `BLOB_BUCKET` from S3
`class MockStatusReporter` | *none* | For testing, logs are available as array on `logs` property

## Barebones Example

Expand Down
14 changes: 14 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,17 @@ export async function deleteS3Keys(keys) {
throw error;
}
}

export class MockStatusReporter {
constructor() {
this.logs = [];
}

log(msg, data) {
this.logs.push({
msg,
data,
time: process.uptime(),
});
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "circuitscan-pipeline-runner",
"version": "0.0.6",
"version": "0.0.7",
"main": "index.js",
"type": "module",
"dependencies": {
Expand Down

0 comments on commit c4e7fb2

Please sign in to comment.