Skip to content

Commit d5a1020

Browse files
authored
Merge pull request #4 from a-bugaj/chore/tests-typo
chore: The names of the tests have been corrected
2 parents 0dd405a + 6f2ffaf commit d5a1020

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

__tests__/pubSub.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ describe("PubSub -> Default Instance", () => {
1010
pubSub = PubSub();
1111
});
1212

13-
it("Should create pubSub instance with subscribers field set to empty array", () => {
13+
it("Should create an instance of pubsub with an empty subscription list", () => {
1414
expect(pubSub.getAllSubscribers()).toEqual([]);
1515
});
1616
});
@@ -22,7 +22,7 @@ describe("PubSub -> Subscribe Method", () => {
2222
pubSub = PubSub();
2323
});
2424

25-
it("Should add event to subscribers array with generated hash key and passed callback ", () => {
25+
it("Should add event to the subscriptions list, with generated hash key and forwarded callback ", () => {
2626
// given
2727
const event = "random.event";
2828

@@ -43,7 +43,7 @@ describe("PubSub -> Subscribe Method", () => {
4343
);
4444
});
4545

46-
it("Should call the subscribe method twice if someone subscribed to one event twice", () => {
46+
it("Should call the subscribe method twice (when someone is subscribed x2 to specific event) after publishing a specific event", () => {
4747
// given
4848
const event = "my.event";
4949

@@ -87,7 +87,7 @@ describe("PubSub -> Unsubscribe Method", () => {
8787
pubSub = PubSub();
8888
});
8989

90-
it("Should remove event from the subscribers array after unsubscribe", () => {
90+
it("Should remove event from the subscribers array", () => {
9191
// given
9292
const event = "unsubscribe.event";
9393

@@ -102,7 +102,7 @@ describe("PubSub -> Unsubscribe Method", () => {
102102
expect(eventsAfterUnsubscribe).toHaveLength(0);
103103
});
104104

105-
it("Should delete a specific event if there are two events with the same name in the subscribers array", () => {
105+
it("Should delete a specific event if there are two events with the same name in the subscribers list", () => {
106106
// given
107107
const event = "random.event";
108108
const callback = jest.fn();
@@ -147,7 +147,7 @@ describe("PubSub -> Publish method", () => {
147147
pubSub = PubSub();
148148
});
149149

150-
it("Should publish event with passed data", () => {
150+
it("Should publish event with payload", () => {
151151
// given
152152
const event = "random.event";
153153
const callback = jest.fn();
@@ -162,7 +162,7 @@ describe("PubSub -> Publish method", () => {
162162
expect(callback).toHaveBeenCalledWith(data);
163163
});
164164

165-
it("Should publish event twice when someone publishing the event twice", () => {
165+
it("Should call callback from subscribe method (twice) after publishing the event twice.", () => {
166166
// given
167167
const event = "nice.event!";
168168
const callback = jest.fn();

0 commit comments

Comments
 (0)