Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add tests for license manager reinit method #9471

Merged
merged 2 commits into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/cli/test/unit/License.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,20 @@ describe('License', () => {
});
});
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for completeness, would be good to have a test of init called with recreate true

Copy link
Contributor Author

@krynble krynble May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, added additional assertion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I meant a separate unit test for init called with recreate = true

it('initializes again if recreate is true', () => {
  ...
  license.init('main', true);
  ...

describe('reinit', () => {
it('should reinitialize license manager', async () => {
const license = new License(mock(), mock(), mock(), mock(), mock());
await license.init();
ivov marked this conversation as resolved.
Show resolved Hide resolved

const initSpy = jest.spyOn(license, 'init');

await license.reinit();

expect(initSpy).toHaveBeenCalledWith('main', true);

expect(LicenseManager.prototype.reset).toHaveBeenCalled();
expect(LicenseManager.prototype.initialize).toHaveBeenCalled();
});
});
});
Loading