-
Notifications
You must be signed in to change notification settings - Fork 22
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
Refactor packages APIs #301
Merged
piotr-roslaniec
merged 24 commits into
nucypher:monorepo
from
piotr-roslaniec:refactor-packages
Oct 6, 2023
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
b58152c
chore(examples): add a nextjs example
piotr-roslaniec b8bb41b
chore(refactor): refactor package tests
piotr-roslaniec 2e6740e
chore(refactor): refactor taco package internals from character based…
piotr-roslaniec 5927d78
chore(refactor): divide shared package into pre and taco
piotr-roslaniec a5e6d8b
chore(examples): add taco examples
piotr-roslaniec da71bf0
chore(test): add multichain condition tests
piotr-roslaniec 7de1be7
chore(deps): deprecate support for node 16
piotr-roslaniec 58254d0
chore: fix vitest test config
piotr-roslaniec 737b215
feat(alpha-13): update coordinator contract
piotr-roslaniec 71b3089
feat(alpha-13): check authorization before encrypting
piotr-roslaniec 2aa2720
chore(examples): update taco/nodejs example
piotr-roslaniec 1292f31
chore(demos): add demos/taco-demo
piotr-roslaniec 5051b03
chore(examples): update examples for alpha-13
piotr-roslaniec a417a00
chore: remove redundant lockfile
piotr-roslaniec ed40754
chore: document legacy demos
piotr-roslaniec 719f6a0
chore(demos): add demos/taco-nft-demo
piotr-roslaniec f3fc336
feat!: deprecate pre-tdec
piotr-roslaniec 7752c24
Update examples/README.md
piotr-roslaniec 9042753
Update examples/taco/webpack-5/src/index.html
piotr-roslaniec d5c70a5
Update demos/taco-demo/README.md
piotr-roslaniec acb0fa1
fix(test): fix pre tests after a bad rebase
piotr-roslaniec fbc90e1
feature(demos): add ritual id input to demos
piotr-roslaniec d2c4bf7
fix(conditions): rpc condition parameters not checking length
piotr-roslaniec 0a13562
feature(allowlist): expose a method to check encrypter authorization
piotr-roslaniec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,3 +1,4 @@ | ||
import { TEST_CONTRACT_ADDR } from '@nucypher/test-utils'; | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
import { RpcCondition } from '../../../src/conditions'; | ||
|
@@ -34,4 +35,52 @@ describe('validation', () => { | |
}, | ||
}); | ||
}); | ||
|
||
describe('parameters', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Love the testing! |
||
it('accepts a single address', () => { | ||
const result = RpcCondition.validate(rpcConditionSchema, { | ||
...testRpcConditionObj, | ||
parameters: [TEST_CONTRACT_ADDR], | ||
}); | ||
|
||
expect(result.error).toBeUndefined(); | ||
expect(result.data).toEqual({ | ||
...testRpcConditionObj, | ||
parameters: [TEST_CONTRACT_ADDR], | ||
}); | ||
}); | ||
|
||
it('accepts a single address and a block number', () => { | ||
const result = RpcCondition.validate(rpcConditionSchema, { | ||
...testRpcConditionObj, | ||
parameters: [TEST_CONTRACT_ADDR, 'latest'], | ||
}); | ||
|
||
expect(result.error).toBeUndefined(); | ||
expect(result.data).toEqual({ | ||
...testRpcConditionObj, | ||
parameters: [TEST_CONTRACT_ADDR, 'latest'], | ||
}); | ||
}); | ||
|
||
it('rejects on an extra parameter', () => { | ||
const result = RpcCondition.validate(rpcConditionSchema, { | ||
...testRpcConditionObj, | ||
parameters: [ | ||
TEST_CONTRACT_ADDR, | ||
'latest', | ||
// Intentionally adding a third, invalid parameter | ||
'0x1234', | ||
], | ||
}); | ||
|
||
expect(result.error).toBeDefined(); | ||
expect(result.data).toBeUndefined(); | ||
expect(result.error?.format()).toMatchObject({ | ||
parameters: { | ||
_errors: ['Array must contain exactly 1 element(s)'], | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great - 🚀