Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
lizozom committed Mar 3, 2022
1 parent b53ad90 commit 7c4dec0
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('ExecutionContextService', () => {
});
});

it('sets context and adds curr url and appid when getting it', () => {
it('sets context and adds current url and appid when getting it', () => {
execContext.set({
type: 'ghf',
description: 'first set',
Expand Down Expand Up @@ -78,16 +78,14 @@ describe('ExecutionContextService', () => {

it('context observable fires the context each time it changes', () => {
const sub = jest.fn();
execContext.context$.subscribe(sub);

// sub gets called immediately with the current value as it's a behavior subject
sub.mockReset();

execContext.set({
type: 'ghf',
description: 'first set',
});

execContext.context$.subscribe(sub);

expect(sub).toHaveBeenCalledWith({
name: 'app1',
type: 'ghf',
Expand All @@ -112,14 +110,14 @@ describe('ExecutionContextService', () => {

it('context observable doesnt fires if the context did not change', () => {
const sub = jest.fn();
execContext.context$.subscribe(sub);
sub.mockReset();

execContext.set({
type: 'ghf',
description: 'first set',
});

execContext.context$.subscribe(sub);

execContext.set({
type: 'ghf',
});
Expand All @@ -134,15 +132,14 @@ describe('ExecutionContextService', () => {
expect(sub).toHaveBeenCalledTimes(1);
});

it('context is cleared and observable is triggered', () => {
it('clear resets context and triggers context observable', () => {
const sub = jest.fn();
execContext.context$.subscribe(sub);
sub.mockReset();

execContext.set({
type: 'ghf',
description: 'first set',
});
execContext.context$.subscribe(sub);

execContext.clear();
expect(sub).toHaveBeenCalledWith({
Expand Down

0 comments on commit 7c4dec0

Please sign in to comment.