-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding chai+snapshot functionality. adding snapshot tests to verify app with new `ordering` file unit tests * undo `await Promise.all` to return to `main` logic. Added comment saying it needs to be fixed but currently the fixture is flaky and warrants a separate investigation ¯\_(ツ)_/¯ * PR feedback. add `ordering` jsdoc and update unit tests to supply additional files to verify that "ordering" is successfully applied
- Loading branch information
Showing
15 changed files
with
1,466 additions
and
36 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 |
---|---|---|
|
@@ -15,6 +15,7 @@ jobs: | |
test: | ||
name: Test | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
node-version: | ||
- '20.10' | ||
|
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,6 @@ | ||
module.exports = { | ||
'watch-files': ['test/**/*.js', 'lib/**/*.js'], | ||
recursive: true, | ||
file: './mocha.setup.js', // setup file before everything else loads | ||
'forbid-only': process.env.CI ?? false, // make sure no `test.only` is merged into `main` | ||
}; |
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,4 @@ | ||
const chai = require('chai'); | ||
const { jestSnapshotPlugin } = require('mocha-chai-jest-snapshot'); | ||
|
||
chai.use(jestSnapshotPlugin()); |
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,276 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`command line interface should respect ordering file (format: "\${filepath}") 1`] = ` | ||
Object { | ||
"files": Object { | ||
"private": Object { | ||
"files": Object { | ||
"var": Object { | ||
"files": Object { | ||
"app": Object { | ||
"files": Object { | ||
"file.txt": Object { | ||
"link": "private/var/file.txt", | ||
}, | ||
}, | ||
}, | ||
"file.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
], | ||
"hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
}, | ||
"offset": "15", | ||
"size": 11, | ||
}, | ||
"file1.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"5b41362bc82b7f3d56edc5a306db22105707d01ff4819e26faef9724a2d406c9", | ||
], | ||
"hash": "5b41362bc82b7f3d56edc5a306db22105707d01ff4819e26faef9724a2d406c9", | ||
}, | ||
"offset": "10", | ||
"size": 5, | ||
}, | ||
"file2.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"d98cf53e0c8b77c14a96358d5b69584225b4bb9026423cbc2f7b0161894c402c", | ||
], | ||
"hash": "d98cf53e0c8b77c14a96358d5b69584225b4bb9026423cbc2f7b0161894c402c", | ||
}, | ||
"offset": "5", | ||
"size": 5, | ||
}, | ||
"file3.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"f60f2d65da046fcaaf8a10bd96b5630104b629e111aff46ce89792e1caa11b18", | ||
], | ||
"hash": "f60f2d65da046fcaaf8a10bd96b5630104b629e111aff46ce89792e1caa11b18", | ||
}, | ||
"offset": "0", | ||
"size": 5, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
"var": Object { | ||
"link": "private/var", | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`command line interface should respect ordering file (format: "\${random number} : \${filepath}") 1`] = ` | ||
Object { | ||
"files": Object { | ||
"private": Object { | ||
"files": Object { | ||
"var": Object { | ||
"files": Object { | ||
"app": Object { | ||
"files": Object { | ||
"file.txt": Object { | ||
"link": "private/var/file.txt", | ||
}, | ||
}, | ||
}, | ||
"file.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
], | ||
"hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
}, | ||
"offset": "15", | ||
"size": 11, | ||
}, | ||
"file1.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"5b41362bc82b7f3d56edc5a306db22105707d01ff4819e26faef9724a2d406c9", | ||
], | ||
"hash": "5b41362bc82b7f3d56edc5a306db22105707d01ff4819e26faef9724a2d406c9", | ||
}, | ||
"offset": "10", | ||
"size": 5, | ||
}, | ||
"file2.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"d98cf53e0c8b77c14a96358d5b69584225b4bb9026423cbc2f7b0161894c402c", | ||
], | ||
"hash": "d98cf53e0c8b77c14a96358d5b69584225b4bb9026423cbc2f7b0161894c402c", | ||
}, | ||
"offset": "5", | ||
"size": 5, | ||
}, | ||
"file3.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"f60f2d65da046fcaaf8a10bd96b5630104b629e111aff46ce89792e1caa11b18", | ||
], | ||
"hash": "f60f2d65da046fcaaf8a10bd96b5630104b629e111aff46ce89792e1caa11b18", | ||
}, | ||
"offset": "0", | ||
"size": 5, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
"var": Object { | ||
"link": "private/var", | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`command line interface should respect ordering file (format: ": \${filepath}") 1`] = ` | ||
Object { | ||
"files": Object { | ||
"private": Object { | ||
"files": Object { | ||
"var": Object { | ||
"files": Object { | ||
"app": Object { | ||
"files": Object { | ||
"file.txt": Object { | ||
"link": "private/var/file.txt", | ||
}, | ||
}, | ||
}, | ||
"file.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
], | ||
"hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
}, | ||
"offset": "15", | ||
"size": 11, | ||
}, | ||
"file1.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"5b41362bc82b7f3d56edc5a306db22105707d01ff4819e26faef9724a2d406c9", | ||
], | ||
"hash": "5b41362bc82b7f3d56edc5a306db22105707d01ff4819e26faef9724a2d406c9", | ||
}, | ||
"offset": "10", | ||
"size": 5, | ||
}, | ||
"file2.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"d98cf53e0c8b77c14a96358d5b69584225b4bb9026423cbc2f7b0161894c402c", | ||
], | ||
"hash": "d98cf53e0c8b77c14a96358d5b69584225b4bb9026423cbc2f7b0161894c402c", | ||
}, | ||
"offset": "5", | ||
"size": 5, | ||
}, | ||
"file3.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"f60f2d65da046fcaaf8a10bd96b5630104b629e111aff46ce89792e1caa11b18", | ||
], | ||
"hash": "f60f2d65da046fcaaf8a10bd96b5630104b629e111aff46ce89792e1caa11b18", | ||
}, | ||
"offset": "0", | ||
"size": 5, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
"var": Object { | ||
"link": "private/var", | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`command line interface should unpack static framework with all underlying symlinks unpacked 1`] = ` | ||
Object { | ||
"files": Object { | ||
"private": Object { | ||
"files": Object { | ||
"var": Object { | ||
"files": Object { | ||
"app": Object { | ||
"files": Object { | ||
"file.txt": Object { | ||
"link": "private/var/file.txt", | ||
"unpacked": true, | ||
}, | ||
}, | ||
}, | ||
"file.txt": Object { | ||
"integrity": Object { | ||
"algorithm": "SHA256", | ||
"blockSize": 4194304, | ||
"blocks": Array [ | ||
"b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
], | ||
"hash": "b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9", | ||
}, | ||
"size": 11, | ||
"unpacked": true, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
"var": Object { | ||
"link": "private/var", | ||
"unpacked": true, | ||
}, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`command line interface should unpack static framework with all underlying symlinks unpacked 2`] = ` | ||
Array [ | ||
Object { | ||
"content": "hello world", | ||
"name": "private/var/app/file.txt", | ||
}, | ||
"private/var/app", | ||
Object { | ||
"content": "hello world", | ||
"name": "private/var/file.txt", | ||
}, | ||
"private/var", | ||
"private", | ||
"var", | ||
] | ||
`; |
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
Oops, something went wrong.