Skip to content

Commit

Permalink
chore: revert code that was added for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
pratik151192 committed Oct 20, 2023
1 parent eed2641 commit bcddc6d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 56 deletions.
2 changes: 1 addition & 1 deletion packages/client-sdk-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"scripts": {
"prebuild": "eslint . --ext .ts",
"test": "jest --testPathIgnorePatterns auth-client.test.ts --reporters=jest-silent-reporter",
"integration-test-auth": "jest auth-client.test.ts -t \"can generate disposable token with valid permissions, expiry and a tokenID\"",
"integration-test-auth": "jest auth-client.test.ts --reporters=jest-silent-reporter",
"integration-test-vector": "jest vector-control-plane.test.ts vector-data-plane.test.ts --reporters=jest-silent-reporter",
"unit-test": "jest unit --reporters=jest-silent-reporter",
"integration-test": "jest integration --reporters=jest-silent-reporter --testPathIgnorePatterns \"auth-client.test.ts|vector-control-plane.test.ts|vector-data-plane.test.ts\"",
Expand Down
55 changes: 0 additions & 55 deletions packages/common-integration-tests/src/topic-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,61 +158,6 @@ export function runTopicClientTests(
(subscribeResponse as TopicSubscribe.Subscription).unsubscribe();
});

it('should publish data with tokenID client and receive them on a subscription', async () => {
const topicName = v4();
const publishedValues = [
'value1',
'value2',
new TextEncoder().encode('value3'),
];
const expectedValues = ['value1', 'value2', uint8ArrayForTest('value3')];
const receivedValues: (string | Uint8Array)[] = [];

let done = false;
const subscribeResponse = await topicClient.subscribe(
integrationTestCacheName,
topicName,
{
onItem: (item: TopicItem) => {
receivedValues.push(item.value());
},
onError: (error: TopicSubscribe.Error) => {
if (!done) {
expect(1).fail(
`Should not receive an error but got one: ${error.message()}`
);
}
},
}
);
expectWithMessage(() => {
expect(subscribeResponse).toBeInstanceOf(TopicSubscribe.Subscription);
}, `expected SUBSCRIPTION but got ${subscribeResponse.toString()}`);

// Wait for stream to start.
await sleep(STREAM_WAIT_TIME_MS);

for (const value of publishedValues) {
const publishResponse = await topicClient.publish(
integrationTestCacheName,
topicName,
value
);
expectWithMessage(() => {
expect(publishResponse).toBeInstanceOf(TopicPublish.Success);
}, `expected SUCCESS but got ${publishResponse.toString()}`);
}

// Wait for values to be received.
await sleep(STREAM_WAIT_TIME_MS);

expect(receivedValues).toEqual(expectedValues);
done = true;

// Need to close the stream before the test ends or else the test will hang.
(subscribeResponse as TopicSubscribe.Subscription).unsubscribe();
});

it('should not receive messages when unsubscribed', async () => {
const topicName = v4();
const publishedValue = 'value';
Expand Down

0 comments on commit bcddc6d

Please sign in to comment.