Skip to content

Commit

Permalink
add many more prisma augments
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Sep 11, 2024
1 parent 0f802f6 commit f50b0a8
Show file tree
Hide file tree
Showing 23 changed files with 1,146 additions and 237 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# augment-vir

Documentation and code for all the current `@augment-vir` packages.
Documentation and code for all the latest `@augment-vir` packages.

- [`@augment-vir/assert`](https://www.npmjs.com/package/@augment-vir/assert): A collection of assertions for test and production code alike. These main exports are the following:
- [`assert`](https://electrovir.github.io/augment-vir/functions/assert.html): a collection of assertion methods with type guards when possible. Example: [`assert.isDefined()`](https://electrovir.github.io/augment-vir/functions/assert.html#isDefined)
Expand Down
46 changes: 23 additions & 23 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "augment-vir-temp-virmator-update",
"version": "30.0.1",
"version": "30.0.2",
"private": true,
"homepage": "https://github.com/electrovir/augment-vir",
"bugs": {
Expand All @@ -25,7 +25,7 @@
"format": "virmator format",
"postinstall": "npm run exec --workspace @augment-vir/scripts src/scripts/fix-mocha-node-module.script.ts",
"lint": "virmator lint fix",
"publish": "virmator publish npm run test:all",
"publish": "virmator publish \"npm run test:all\"",
"test": "mono-vir for-each npm run test",
"test:all": "npm run compile && npm run test:coverage && concurrently --colors --kill-others-on-fail -c auto --names spelling,format,deps,lint,exports,docs \"npm run test:spelling\" \"npm run test:format\" \"npm run test:deps\" \"npm run test:lint\" \"npm run test:exports\" \"npm run test:docs\"",
"test:coverage": "mono-vir for-each npm run test:coverage",
Expand Down
4 changes: 2 additions & 2 deletions packages/assert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@augment-vir/assert",
"version": "30.0.1",
"version": "30.0.2",
"description": "A collection of assertions for test and production code alike.",
"keywords": [
"augment",
Expand Down Expand Up @@ -41,7 +41,7 @@
"test:update": "npm test"
},
"dependencies": {
"@augment-vir/core": "^30.0.1",
"@augment-vir/core": "^30.0.2",
"@date-vir/duration": "^6.0.0",
"deep-eql": "^5.0.2",
"expect-type": "^0.20.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@augment-vir/common",
"version": "30.0.1",
"version": "30.0.2",
"description": "A collection of augments, helpers types, functions, and classes for any JavaScript environment.",
"keywords": [
"augment",
Expand Down Expand Up @@ -39,8 +39,8 @@
"test:web": "virmator --no-deps test web"
},
"dependencies": {
"@augment-vir/assert": "^30.0.1",
"@augment-vir/core": "^30.0.1",
"@augment-vir/assert": "^30.0.2",
"@augment-vir/core": "^30.0.2",
"@date-vir/duration": "^6.0.0",
"ansi-styles": "^6.2.1",
"json5": "^2.2.3",
Expand Down
109 changes: 106 additions & 3 deletions packages/common/src/augments/array/array-to-object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,116 @@ describe(arrayToObject.name, () => {
[],
(value) => {
return {
value,
key: 'five',
value,
};
},
],
expect: {},
},
{
it: 'handles an async callback',
inputs: [
['value'],
(value) => {
return Promise.resolve({
key: 'five',
value,
});
},
],
expect: {five: 'value'},
},
{
it: 'filters out undefined async values',
inputs: [
[
true,
false,
],
(value) => {
if (!value) {
return Promise.resolve(undefined);
}

return Promise.resolve({
key: 'five',
value,
});
},
],
expect: {five: true},
},
{
it: 'handles a mix of sync and async values',
inputs: [
[
true,
false,
],
(value) => {
if (value) {
return Promise.resolve({
key: 'async',
value,
});
} else {
return {
key: 'sync',
value,
};
}
},
],
expect: {
sync: false,
async: true,
},
},
{
it: 'filters out undefined sync values',
inputs: [
[
true,
false,
],
(value) => {
if (!value) {
return undefined;
}

return {
key: 'five',
value,
};
},
],
expect: {five: true},
},
{
it: 'handles an async callback error',
inputs: [
['value'],
() => {
return Promise.reject(new Error('reasons'));
},
],
throws: {
matchMessage: 'reasons',
},
},
{
it: 'handles a sync callback error',
inputs: [
['value'],
() => {
throw new Error('reasons');
},
],
throws: {
matchMessage: 'reasons',
},
},
{
it: 'handles no collisions',
inputs: [
Expand All @@ -197,8 +300,8 @@ describe(arrayToObject.name, () => {
],
(value: any) => {
return {
value,
key: value.c,
value,
};
},
],
Expand Down Expand Up @@ -248,8 +351,8 @@ describe(arrayToObject.name, () => {
],
(value: any) => {
return {
value,
key: value.c,
value,
};
},
],
Expand Down
Loading

0 comments on commit f50b0a8

Please sign in to comment.