Skip to content

Commit 69c1f80

Browse files
jeskewsrchase
authored andcommitted
Add buildspec.yml to orchestrate pull request testing (#61)
* Add buildspec.yml to orchestrate pull request testing * Ensure all packages have the correct types at their disposal * Prep SNS Message validator for upgrade to Jest 21 and ensure the CPU-intensive test has an adequate timeout * Ensure everything still compiles even with TypeScript 2.6's strict function types * Match any 32-char hex string for temp directories rather than mocking out crypto.randomBytes
1 parent 6f69cf7 commit 69c1f80

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

packages/shared-ini-file-loader/src/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jest.mock('fs', () => {
99
interface FsModule {
1010
__addMatcher(toMatch: string, toReturn: string): void;
1111
__clearMatchers(): void;
12-
readFile: (path: string, encoding: string, cb: Function) => void
12+
readFile: (path: string, encoding: string, cb: (err: Error|null, data?: string) => void) => void
1313
}
1414

1515
const fs: FsModule = <FsModule>jest.genMockFromModule('fs');

packages/signature-v4/src/SignatureV4.spec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {
1818
import {Sha256} from "@aws/crypto-sha256-node";
1919
import {Credentials, HttpRequest} from "@aws/types";
2020
import {iso8601} from "@aws/protocol-timestamp";
21-
import {PassThrough} from 'stream';
2221

2322
const signer = new SignatureV4({
2423
service: 'foo',
@@ -45,6 +44,11 @@ const credentials: Credentials = {
4544
secretAccessKey: 'bar',
4645
};
4746

47+
/**
48+
* An environment specific stream that the signer knows nothing about.
49+
*/
50+
class ExoticStream {}
51+
4852
describe('SignatureV4', () => {
4953
describe('#presignRequest', () => {
5054
const expiration = Math.floor(
@@ -109,7 +113,7 @@ describe('SignatureV4', () => {
109113
const {query} = await signer.presignRequest({
110114
request: {
111115
...minimalRequest,
112-
body: new PassThrough()
116+
body: new ExoticStream()
113117
},
114118
expiration,
115119
signingDate: new Date('2000-01-01T00:00:00.000Z'),
@@ -317,7 +321,7 @@ describe('SignatureV4', () => {
317321
const {headers} = await signer.signRequest({
318322
request: {
319323
...minimalRequest,
320-
body: new PassThrough(),
324+
body: new ExoticStream(),
321325
},
322326
signingDate: new Date('2000-01-01T00:00:00.000Z'),
323327
});

packages/signature-v4/src/getPayloadHash.spec.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {getPayloadHash} from "./getPayloadHash";
22
import {SHA256_HEADER, UNSIGNED_PAYLOAD} from "./constants";
33
import {HttpRequest} from "@aws/types";
44
import {Sha256} from "@aws/crypto-sha256-node";
5-
import {PassThrough} from 'stream';
65

76
describe('getPayloadHash', () => {
87
const minimalRequest: HttpRequest<any> = {
@@ -79,10 +78,15 @@ describe('getPayloadHash', () => {
7978
it(
8079
`should return ${UNSIGNED_PAYLOAD} if the request has a streaming body and no stream collector is provided`,
8180
async () => {
81+
/**
82+
* An environment specific stream that the signer knows nothing about.
83+
*/
84+
class ExoticStream {}
85+
8286
await expect(getPayloadHash(
8387
{
8488
...minimalRequest,
85-
body: new PassThrough(),
89+
body: new ExoticStream(),
8690
},
8791
Sha256
8892
)).resolves.toBe(UNSIGNED_PAYLOAD);

0 commit comments

Comments
 (0)