Skip to content

Commit 8f69547

Browse files
committed
Rename promises in unit test
1 parent 3268957 commit 8f69547

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/test/tests.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ describe('RedisPubSub', () => {
141141
});
142142

143143
it('concurrent subscribe, unsubscribe first sub before second sub complete', done => {
144-
const subs = {
145-
first: null as Promise<number>,
146-
second: null as Promise<number>,
144+
const promises = {
145+
firstSub: null as Promise<number>,
146+
secondSub: null as Promise<number>,
147147
}
148148

149149
let firstCb, secondCb
@@ -152,7 +152,7 @@ describe('RedisPubSub', () => {
152152
if (!firstCb) {
153153
firstCb = () => cb(null, channel)
154154
// Handling first call, init second sub
155-
subs.second = pubSub.subscribe('Posts', () => null)
155+
promises.secondSub = pubSub.subscribe('Posts', () => null)
156156
// Continue first sub callback
157157
firstCb()
158158
} else {
@@ -167,26 +167,26 @@ describe('RedisPubSub', () => {
167167

168168
// First leg of the test, init first sub and immediately unsubscribe. The second sub is triggered in the redis cb
169169
// before the first promise sub complete
170-
subs.first = pubSub.subscribe('Posts', () => null)
170+
promises.firstSub = pubSub.subscribe('Posts', () => null)
171171
.then(subId => {
172172
// This assertion is done against a private member, if you change the internals, you may want to change that
173173
expect((pubSub as any).subscriptionMap[subId]).not.to.be.an('undefined');
174174
pubSub.unsubscribe(subId);
175175

176176
// Continue second sub callback
177-
subs.first.then(() => secondCb())
177+
promises.firstSub.then(() => secondCb())
178178
return subId;
179179
});
180180

181181
// Second leg of the test, here we have unsubscribed from the first sub. We try unsubbing from the second sub
182182
// as soon it is ready
183-
subs.first
183+
promises.firstSub
184184
.then((subId) => {
185185
// This assertion is done against a private member, if you change the internals, you may want to change that
186186
expect((pubSub as any).subscriptionMap[subId]).to.be.an('undefined');
187187
expect(() => pubSub.unsubscribe(subId)).to.throw(`There is no subscription of id "${subId}"`);
188188

189-
return subs.second.then(secondSubId => {
189+
return promises.secondSub.then(secondSubId => {
190190
pubSub.unsubscribe(secondSubId);
191191
})
192192
.then(done)

0 commit comments

Comments
 (0)