Skip to content

Commit 9a77a31

Browse files
author
Artem
committed
fix tests
1 parent 0d6f48c commit 9a77a31

File tree

2 files changed

+4
-31
lines changed

2 files changed

+4
-31
lines changed

redisinsight/api/test/api/pub-sub/POST-instance-id-pub-sub-messages.test.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ import {
99
validateInvalidDataTestCase,
1010
validateApiCall
1111
} from '../deps';
12-
import { Socket } from 'socket.io-client';
13-
const { server, request, constants, rte, getSocket } = deps;
12+
const { server, request, constants, rte } = deps;
1413

1514
// endpoint to test
1615
const endpoint = (instanceId = constants.TEST_INSTANCE_ID) =>
@@ -51,19 +50,6 @@ const mainCheckFn = async (testCase) => {
5150
});
5251
};
5352

54-
const getClient = async (instanceId): Promise<Socket> => {
55-
return getSocket('pub-sub', {
56-
query: { instanceId },
57-
});
58-
};
59-
60-
const pSubscription = {
61-
channel: '*',
62-
type: 'p',
63-
};
64-
65-
let client;
66-
6753
describe('POST /instance/:instanceId/pub-sub/messages', () => {
6854
describe('Validation', () => {
6955
generateInvalidDataTestCases(dataSchema, validInputData).map(
@@ -72,17 +58,6 @@ describe('POST /instance/:instanceId/pub-sub/messages', () => {
7258
});
7359

7460
describe('Common', () => {
75-
beforeEach(async () => {
76-
client = await getClient(constants.TEST_INSTANCE_ID);
77-
await new Promise((res) => {
78-
client.emit('subscribe', { subscriptions: [pSubscription] }, res);
79-
});
80-
});
81-
82-
afterEach(async () => {
83-
client.close();
84-
});
85-
8661
[
8762
{
8863
name: 'Should send message',
@@ -91,9 +66,6 @@ describe('POST /instance/:instanceId/pub-sub/messages', () => {
9166
},
9267
responseSchema,
9368
statusCode: 201,
94-
responseBody: {
95-
affected: 1,
96-
},
9769
},
9870
{
9971
name: 'Should return NotFound error if instance id does not exists',

redisinsight/api/test/api/ws/pub-sub/pub-sub.test.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ describe('pub-sub', function () {
100100
expect(ack).to.eql({ status: 'ok' });
101101

102102
client.on('s:channel-a', (data) => {
103+
console.log('___data', data);
103104
expect(data.count).to.be.eql(1);
104105
expect(data.messages.length).to.be.eql(1);
105106
const [message] = data.messages;
@@ -113,8 +114,8 @@ describe('pub-sub', function () {
113114
reject(new Error('Should not receive message-a in this listener-b'))
114115
});
115116

116-
await rte.data.executeCommand('publish', 'channel-c', 'message-c');
117-
await rte.data.executeCommand('publish', 'channel-a', 'message-a');
117+
await rte.data.sendCommand('publish', ['channel-c', 'message-c']);
118+
await rte.data.sendCommand('publish', ['channel-a', 'message-a']);
118119
})
119120
});
120121
});

0 commit comments

Comments
 (0)