-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Release floating entitlements on license:clear command (no-chan…
…gelog) (#9603) Co-authored-by: Iván Ovejero <[email protected]>
- Loading branch information
1 parent
39ddaac
commit 8f93b0b
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/cli/test/integration/commands/license.cmd.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { InternalHooks } from '@/InternalHooks'; | ||
import { License } from '@/License'; | ||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials'; | ||
import { ClearLicenseCommand } from '@/commands/license/clear'; | ||
import { Config } from '@oclif/core'; | ||
import { mockInstance } from '../../shared/mocking'; | ||
|
||
const oclifConfig = new Config({ root: __dirname }); | ||
|
||
beforeAll(async () => { | ||
mockInstance(InternalHooks); | ||
mockInstance(LoadNodesAndCredentials); | ||
await oclifConfig.load(); | ||
}); | ||
|
||
test('license:clear invokes shutdown() to release any floating entitlements', async () => { | ||
const cmd = new ClearLicenseCommand([], oclifConfig); | ||
await cmd.init(); | ||
|
||
const license = mockInstance(License); | ||
|
||
await cmd.run(); | ||
|
||
expect(license.init).toHaveBeenCalledTimes(1); | ||
expect(license.shutdown).toHaveBeenCalledTimes(1); | ||
|
||
jest.restoreAllMocks(); | ||
}); |