Skip to content

Commit 61bff83

Browse files
committed
chore: cleanup plugin specs and skip them
1 parent a810955 commit 61bff83

File tree

4 files changed

+29
-36
lines changed

4 files changed

+29
-36
lines changed

test/matt.consumer.integration.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe.skip('MATT protocol test', () => {
8181
});
8282
});
8383

84-
describe.only('TCP Messages', () => {
84+
describe('TCP Messages', () => {
8585
beforeEach(() => {
8686
tcpProvider = makeConsumerMessagePact(
8787
'matt-tcp-consumer',

test/matt.provider.integration.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ const startHTTPServer = (host: string, port: number): Promise<http.Server> => {
5252
const server: express.Express = express();
5353

5454
server.post('/matt', (req, res) => {
55-
console.log('received a /matt message', req.body);
5655
res.setHeader('content-type', 'application/matt');
5756
res.send(generateMattMessage('world'));
5857
});
@@ -67,13 +66,14 @@ const startTCPServer = (host: string, port: number) => {
6766
const server = net.createServer();
6867

6968
server.on('connection', (sock) => {
70-
console.log(`Connected to client ${sock.remoteAddress}:${sock.remotePort}`);
71-
7269
sock.on('data', (data) => {
7370
const msg = parseMattMessage(data.toString());
74-
console.log(`Received data from ${sock.remoteAddress}: ${msg}`);
7571

76-
sock.write(generateMattMessage('tcpworld'));
72+
if (msg === "hellotcp") {
73+
sock.write(generateMattMessage('tcpworld'));
74+
} else {
75+
sock.write(generateMattMessage('message not understood'));
76+
}
7777
sock.write('\n');
7878
});
7979
});
@@ -82,7 +82,6 @@ const startTCPServer = (host: string, port: number) => {
8282
server.listen(port, host);
8383

8484
server.on('listening', () => {
85-
console.log('listening!');
8685
resolve(null);
8786
});
8887
});

test/message.integration.spec.ts

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import chai = require('chai');
2+
import path = require('path');
23
import chaiAsPromised = require('chai-as-promised');
34
import * as rimraf from 'rimraf';
45
import zlib = require('zlib');
@@ -16,26 +17,26 @@ const isOSX = process.platform === 'darwin';
1617
const isCI = process.env.CI === 'true';
1718

1819
describe('FFI integration test for the Message Consumer API', () => {
19-
setLogLevel('trace');
20+
setLogLevel('error');
2021

2122
let pact: ConsumerMessagePact;
2223
const secret = 'this is an encoded string';
2324
const bytes: Buffer = zlib.gzipSync(secret);
2425

26+
before(() => {
27+
rimraf.sync(path.join(__dirname, '__testoutput__', 'message-consumer*'))
28+
});
29+
2530
beforeEach(() => {
26-
rimraf.sync('/tmp/pact/*.json');
31+
pact = makeConsumerMessagePact(
32+
'message-consumer',
33+
'message-provider',
34+
FfiSpecificationVersion.SPECIFICATION_VERSION_V4
35+
);
2736
});
2837

2938
describe('Asynchronous Messages', () => {
3039
describe('with JSON data', () => {
31-
beforeEach(() => {
32-
pact = makeConsumerMessagePact(
33-
'message-consumer',
34-
'message-provider',
35-
FfiSpecificationVersion.SPECIFICATION_VERSION_V3
36-
);
37-
});
38-
3940
it('generates a pact with success', () => {
4041
pact.addMetadata('pact-node', 'meta-key', 'meta-val');
4142
const message = pact.newAsynchronousMessage('');
@@ -50,9 +51,9 @@ describe('FFI integration test for the Message Consumer API', () => {
5051

5152
const reified = message.reifyMessage();
5253

53-
expect(JSON.parse(reified).contents).to.have.property('foo', 'bar');
54+
expect(JSON.parse(reified).contents.content).to.have.property('foo', 'bar');
5455

55-
pact.writePactFile('/tmp/pact');
56+
pact.writePactFile(path.join(__dirname, '__testoutput__'));
5657
});
5758
});
5859

@@ -79,22 +80,16 @@ describe('FFI integration test for the Message Consumer API', () => {
7980
const contents = JSON.parse(reified).contents;
8081

8182
// Check the base64 encoded contents can be decoded, unzipped and equals the secret
82-
const buf = Buffer.from(contents, 'base64');
83+
const buf = Buffer.from(contents.content, 'base64');
8384
const deflated = zlib.gunzipSync(buf).toString('utf8');
8485
expect(deflated).to.equal(secret);
8586

86-
pact.writePactFile('/tmp/pact');
87+
pact.writePactFile(path.join(__dirname, '__testoutput__'));
8788
});
8889
});
8990
});
91+
9092
describe('Synchronous Messages', () => {
91-
beforeEach(() => {
92-
pact = makeConsumerMessagePact(
93-
'message-consumer',
94-
'message-provider',
95-
FfiSpecificationVersion.SPECIFICATION_VERSION_V4
96-
);
97-
});
9893
describe('with JSON data', () => {
9994
it('generates a pact with success', () => {
10095
pact.addMetadata('pact-node', 'meta-key', 'meta-val');
@@ -115,7 +110,7 @@ describe('FFI integration test for the Message Consumer API', () => {
115110

116111
// expect(JSON.parse(reified).contents).to.have.property('foo', 'bar');
117112

118-
pact.writePactFile('/tmp/pact');
113+
pact.writePactFile(path.join(__dirname, '__testoutput__'));
119114
});
120115
});
121116

@@ -152,14 +147,13 @@ describe('FFI integration test for the Message Consumer API', () => {
152147
pact.addMetadata('pact-node', 'meta-key', 'meta-val');
153148
pact.addPlugin('protobuf', '0.1.14');
154149

155-
const message = pact.newSynchronousMessage('a grpc test');
156-
message.given('some state');
157-
message.givenWithParam('some state 2', 'state2 key', 'state2 val');
150+
const message = pact.newSynchronousMessage('a grpc test 1');
151+
message.given('some state 1');
158152
message.withPluginRequestResponseInteractionContents(
159153
'application/protobuf',
160154
grpcInteraction
161155
);
162-
message.withMetadata('meta-key', 'meta-val');
156+
message.withMetadata('meta-key 1', 'meta-val 2');
163157

164158
port = pact.pactffiCreateMockServerForTransport(
165159
'127.0.0.1',
@@ -178,7 +172,7 @@ describe('FFI integration test for the Message Consumer API', () => {
178172
const mismatches = pact.mockServerMismatches(port);
179173
expect(mismatches.length).to.eq(0);
180174

181-
pact.writePactFile('/tmp/pact');
175+
pact.writePactFile(path.join(__dirname, '__testoutput__'));
182176
});
183177
});
184178
});

test/plugin-verifier.integration.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ chai.use(chaiAsPromised);
1515
const HTTP_PORT = 50051;
1616
const GRPC_PORT = 50052;
1717

18-
describe('Verifier Integration Spec', () => {
18+
describe.skip('Plugin Verifier Integration Spec', () => {
1919
context('plugin tests', () => {
2020
describe('grpc interaction', () => {
2121
before(async () => {
@@ -40,7 +40,7 @@ describe('Verifier Integration Spec', () => {
4040
expect('').to.eq('');
4141
});
4242

43-
it.skip('runs the grpc client', async () => {
43+
it('runs the grpc client', async () => {
4444
const protoFile = `${__dirname}/integration/grpc/route_guide.proto`;
4545
const feature = await getFeature(`127.0.0.1:${GRPC_PORT}`, protoFile);
4646

0 commit comments

Comments
 (0)