-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.0.x-alpha' into feature/apollo-graphql-link-server
- Loading branch information
Showing
24 changed files
with
7,118 additions
and
6,260 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 |
---|---|---|
|
@@ -12,6 +12,12 @@ ex: `[email protected]` | |
|
||
Lerna will not push the git tags after creation. You should push the git tags once you are confident in your changes. | ||
|
||
### Example | ||
|
||
``` | ||
lerna version prerelease --sign-git-commit | ||
``` | ||
|
||
## Publishing | ||
|
||
The `Test, Build, Release` Workflow on GitHub can be run to [manually trigger](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) publishing of packages to NPM. This workflow will only publish versions which do not already exist on NPM. | ||
|
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
10 changes: 10 additions & 0 deletions
10
.../rsocket-composite-metadata/__tests__/__snapshots__/encodeWellKnownMetadataHeader.ts.snap
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,10 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`encodeWellKnownMetadataHeader encodes the header as per spec 1`] = ` | ||
Array [ | ||
133, | ||
0, | ||
0, | ||
16, | ||
] | ||
`; |
40 changes: 40 additions & 0 deletions
40
packages/rsocket-composite-metadata/__tests__/encodeAndAddCustomMetadata.spec.ts
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,40 @@ | ||
import { encodeAndAddCustomMetadata } from "rsocket-composite-metadata"; | ||
import { hex } from "./test-utils/hex"; | ||
|
||
describe("encodeAndAddCustomMetadata", () => { | ||
it("throws if custom mimtype length is less than 1", () => { | ||
expect(() => | ||
encodeAndAddCustomMetadata(Buffer.from([]), "", Buffer.from("1234")) | ||
).toThrow( | ||
"Custom mime type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128" | ||
); | ||
}); | ||
|
||
it("throws if custom mimtype length is greater than 127", () => { | ||
let mime = ""; | ||
while (mime.length < 130) { | ||
mime += "a"; | ||
} | ||
expect(() => | ||
encodeAndAddCustomMetadata(Buffer.from([]), mime, Buffer.from("1234")) | ||
).toThrow( | ||
"Custom mime type must have a strictly positive length that fits on 7 unsigned bits, ie 1-128" | ||
); | ||
}); | ||
|
||
it("encodes the header and payload as per spec", () => { | ||
const { c, u, s, t, o, m } = hex; | ||
const metadata = encodeAndAddCustomMetadata( | ||
Buffer.from([]), | ||
"custom", | ||
Buffer.from("1234") | ||
); | ||
const expectedHeaderLength8 = "05"; | ||
const expectedPayloadLength24 = "000004"; | ||
const expectedHeader = `${expectedHeaderLength8}${c}${u}${s}${t}${o}${m}${expectedPayloadLength24}`; | ||
const expectedPayload = `${hex["1"]}${hex["2"]}${hex["3"]}${hex["4"]}`; | ||
expect(metadata.toString("hex")).toBe( | ||
`${expectedHeader}${expectedPayload}` | ||
); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
packages/rsocket-composite-metadata/__tests__/encodeAndAddWellKnownMetadata.ts
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,44 @@ | ||
import { | ||
encodeAndAddWellKnownMetadata, | ||
WellKnownMimeType, | ||
} from "rsocket-composite-metadata"; | ||
import { readUInt24BE } from "rsocket-core"; | ||
|
||
describe("encodeWellKnownMetadataHeader", () => { | ||
it("encodes the header as per spec when WellKnownMimeType given", () => { | ||
const metadata = encodeAndAddWellKnownMetadata( | ||
Buffer.from([]), | ||
WellKnownMimeType.MESSAGE_RSOCKET_MIMETYPE, | ||
Buffer.from("test") | ||
); | ||
|
||
// 122 | 128 | ||
const maskedId = metadata.readUInt8(0); | ||
const length = readUInt24BE(metadata, 1); | ||
const value = metadata.slice(4, metadata.length); | ||
|
||
expect(maskedId).toBe(250); | ||
expect(length).toBe(4); | ||
expect(value.length).toBe(4); | ||
expect(value.toString("utf-8")).toBe("test"); | ||
}); | ||
|
||
it("encodes the header as per spec when identifier given", () => { | ||
const metadata = encodeAndAddWellKnownMetadata( | ||
Buffer.from([]), | ||
// MESSAGE_RSOCKET_MIMETYPE | ||
122, | ||
Buffer.from("test") | ||
); | ||
|
||
// 122 | 128 | ||
const maskedId = metadata.readUInt8(0); | ||
const length = readUInt24BE(metadata, 1); | ||
const value = metadata.slice(4, metadata.length); | ||
|
||
expect(maskedId).toBe(250); | ||
expect(length).toBe(4); | ||
expect(value.length).toBe(4); | ||
expect(value.toString("utf-8")).toBe("test"); | ||
}); | ||
}); |
Oops, something went wrong.