-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests and update monitor script to support block monitoring parameter. * Add `test/sample.test.ts` with a sample test case using Jest. * Add `test/monitor.test.ts` with a test case for the monitor script using Jest. * Modify `.github/workflows/check.yml` and `.github/workflows/verify-compilation.yml` to include jobs to run tests using Jest. * Modify `.dockerignore` and `.npmignore` to ensure the `test` directory is not excluded. * Modify `src/tools/monitor.ts` to add a new feature to the monitor script that uses a parameter to specify the number of blocks to monitor until it stops. * Modify `src/utils/monitoring.ts` to update the `listenBlocks` function to support the new parameter as optional. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/Moonsong-Labs/moonbeam-tools?shareId=XXXX-XXXX-XXXX-XXXX).
- Loading branch information
Showing
8 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
/test | ||
/bins | ||
/build | ||
/dist | ||
|
@@ -7,4 +6,4 @@ | |
.github | ||
|
||
*.log | ||
*.bak | ||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
/scripts | ||
/test | ||
/bins | ||
/build | ||
/docker | ||
|
@@ -10,4 +9,4 @@ | |
.github | ||
|
||
*.log | ||
*.bak | ||
*.bak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { exec } from 'child_process'; | ||
|
||
describe('Monitor Script', () => { | ||
test('should run without errors', (done) => { | ||
exec('node dist/monitor.cjs --networks moonriver', (error, stdout, stderr) => { | ||
expect(error).toBeNull(); | ||
expect(stderr).toBe(''); | ||
expect(stdout).toContain('Monitoring'); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { sum } from '../src/utils/functions'; | ||
|
||
describe('Sample Test', () => { | ||
test('adds 1 + 2 to equal 3', () => { | ||
expect(sum(1, 2)).toBe(3); | ||
}); | ||
}); |