-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tbdex submodules to consume test vectors and JSON schemas (#129)
* Use git submodule for hosted schemas and test vectors * Clean up extra test vector directory copy * Copy test vectors into generated/ * Github Actions checkout submodule where appropriate * Add chai-as-promised * Use tbdex-interop-suite for submodule * Revert "Use tbdex-interop-suite for submodule" This reverts commit 3a5e39b. * Sparse-checkout submodule tbdex/hosted * Add submodule usage instructions to README * PR comments * Update README.md Co-authored-by: Frank Hinek <[email protected]> * Fix audit * Move cloning to prereqs in README; remove chai-as-promised * Update tbdex submod to latest main --------- Co-authored-by: Frank Hinek <[email protected]>
- Loading branch information
1 parent
a7bc582
commit 650aea7
Showing
13 changed files
with
120 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
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
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,3 @@ | ||
[submodule "tbdex"] | ||
path = tbdex | ||
url = https://github.com/TBD54566975/tbdex.git |
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 |
---|---|---|
|
@@ -12,6 +12,20 @@ This multi-package repository uses [`pnpm` workspaces](https://pnpm.io/workspace | |
|
||
## Prerequisites | ||
|
||
### Cloning | ||
This repository uses git submodules. To clone this repo with submodules | ||
```sh | ||
git clone --recurse-submodules [email protected]:TBD54566975/tbdex-js.git | ||
``` | ||
Or to add submodules after cloning | ||
```sh | ||
git submodule update --init | ||
``` | ||
We recommend this config which will only checkout the files relevant to tbdex-js | ||
```sh | ||
git -C tbdex sparse-checkout set hosted | ||
``` | ||
|
||
### `node` | ||
|
||
This project is using `node v20.3.0`. You can verify your `node` and `npm` installation via the terminal: | ||
|
@@ -93,3 +107,21 @@ Recap of the above changesets, plus the release process: | |
5. Profit from the release automation: | ||
- [Create GH Release Workflow](./.github/workflows/create-gh-release.yml) will automatically create a new [GitHub Release](https://github.com/TBD54566975/tbdex-js/releases) | ||
- [NPM Publish Workflow](./.github/workflows/npm-publish.yml) will automatically publish a [new version to NPM](https://www.npmjs.com/package/@tbdex/protocol?activeTab=versions) | ||
|
||
## Working with the `tbdex` submodule | ||
|
||
### Pulling | ||
You may need to update the `tbdex` submodule after pulling. | ||
```sh | ||
git pull | ||
git submodule update | ||
``` | ||
|
||
### Pushing | ||
If you have made changes to the `tbdex` submodule, you should push your changes to the `tbdex` remote as well as pushing changes to `tbdex-js`. | ||
```sh | ||
cd tbdex | ||
git push | ||
cd .. | ||
git push | ||
``` |
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
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,42 @@ | ||
import { expect } from 'chai' | ||
import { Close, Order, OrderStatus, Quote, Rfq } from '../src/message-kinds/index.js' | ||
import { Offering } from '../src/resource-kinds/index.js' | ||
import ParseClose from '../generated/test-vectors/parse-close.json' assert { type: 'json' } | ||
import ParseOffering from '../generated/test-vectors/parse-offering.json' assert { type: 'json' } | ||
import ParseOrder from '../generated/test-vectors/parse-order.json' assert { type: 'json' } | ||
import ParseOrderStatus from '../generated/test-vectors/parse-orderstatus.json' assert { type: 'json' } | ||
import ParseQuote from '../generated/test-vectors/parse-quote.json' assert { type: 'json' } | ||
import ParseRfq from '../generated/test-vectors/parse-rfq.json' assert { type: 'json' } | ||
|
||
describe('Test vectors: parse and serialize', () => { | ||
it('parse-close.json', async () => { | ||
const close = await Close.parse(ParseClose.input) | ||
expect(close.toJSON()).to.deep.eq(ParseClose.output) | ||
}) | ||
|
||
it('parse-offering.json', async() => { | ||
const offering = await Offering.parse(ParseOffering.input) | ||
expect(offering.toJSON()).to.deep.eq(ParseOffering.output) | ||
}) | ||
|
||
it('parse-order.json', async () => { | ||
const order = await Order.parse(ParseOrder.input) | ||
expect(order.toJSON()).to.deep.eq(ParseOrder.output) | ||
}) | ||
|
||
it('parse-orderstatus.json', async () => { | ||
const orderstatus = await OrderStatus.parse(ParseOrderStatus.input) | ||
expect(orderstatus.toJSON()).to.deep.eq(ParseOrderStatus.output) | ||
}) | ||
|
||
it('parse-quote.json', async () => { | ||
const quote = await Quote.parse(ParseQuote.input) | ||
expect(quote.toJSON()).to.deep.eq(ParseQuote.output) | ||
}) | ||
|
||
it('parse-rfq.json', async () => { | ||
const rfq = await Rfq.parse(ParseRfq.input) | ||
expect(rfq.toJSON()).to.deep.eq(ParseRfq.output) | ||
}) | ||
}) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.