diff --git a/package.json b/package.json index c6c8556..6463647 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "@adobe/aio-lib-env": "^3", "@adobe/aio-lib-ims": "^8", "@oclif/core": "^4.0.0", - "hyperlinker": "^1.0.0", "js-yaml": "^4.1.0", "open": "^10.2.0" }, diff --git a/src/commands/console/api/list.js b/src/commands/console/api/list.js index 400df49..562461d 100644 --- a/src/commands/console/api/list.js +++ b/src/commands/console/api/list.js @@ -27,7 +27,6 @@ class ListCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const enabledServices = await this.consoleCLI.getEnabledServicesForOrg(orgId) aioConsoleLogger.debug(`Enabled services: ${JSON.stringify(enabledServices.map(s => s.code))}`) diff --git a/src/commands/console/index.js b/src/commands/console/index.js index fdb7ea7..6904439 100644 --- a/src/commands/console/index.js +++ b/src/commands/console/index.js @@ -18,11 +18,8 @@ const LibConsoleCLI = require('@adobe/aio-cli-lib-console') const { CLI } = require('@adobe/aio-lib-ims/src/context') const { getCliEnv } = require('@adobe/aio-lib-env') const yaml = require('js-yaml') -const hyperlinker = require('hyperlinker') const { CONFIG_KEYS, API_KEYS } = require('../../config') -const DEV_TERMS_URL = 'https://www.adobe.com/go/developer-terms' - class ConsoleCommand extends Command { async run () { const help = new Help(this.config) @@ -92,39 +89,6 @@ class ConsoleCommand extends Command { LibConsoleCLI.cleanStdOut() } - /** - * Ensure the Developer Terms of Service have been accepted for the given org. - * Mirrors the flow in @adobe/aio-cli-plugin-app's `app init` command so that - * `console` subcommands surface a CLI-native prompt instead of leaking a raw - * 451 "use POST /console/services/ims/organizations/:orgId/terms" message - * from the underlying SDK. - * - * @param {object} consoleCLI initialised @adobe/aio-cli-lib-console instance (this.consoleCLI) - * @param {string} orgId organization id to check - * @param {boolean} [skipPrompts] when true, fail fast instead of prompting (default false) - * @returns {Promise} - */ - async ensureDevTermAccepted (consoleCLI, orgId, skipPrompts = false) { - const isTermAccepted = await consoleCLI.checkDevTermsForOrg(orgId) - if (isTermAccepted) { - return - } - if (skipPrompts) { - this.error('Developer Terms of Service have not been accepted for this organization. Please re-run this command without `--json`/`--yml`, or run `aio app init` to accept the terms first.') - } - const terms = await consoleCLI.getDevTermsForOrg() - const termsText = terms.text ? terms.text.trim() : '' - const confirmDevTerms = await consoleCLI.prompt.promptConfirm(`${termsText}\n\nYou have not accepted the Developer Terms of Service. Go to ${hyperlinker(DEV_TERMS_URL, DEV_TERMS_URL)} to view the terms. Do you accept the terms? (y/n):`) - if (!confirmDevTerms) { - this.error('The Developer Terms of Service were declined') - } - const accepted = await consoleCLI.acceptDevTermsForOrg(orgId) - if (!accepted) { - this.error('The Developer Terms of Service could not be accepted') - } - this.log(`The Developer Terms of Service were successfully accepted for org ${orgId}`) - } - /** * Set console config * diff --git a/src/commands/console/project/create.js b/src/commands/console/project/create.js index 6858bf5..3f4c85a 100644 --- a/src/commands/console/project/create.js +++ b/src/commands/console/project/create.js @@ -54,7 +54,6 @@ class CreateCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) // check name is not already in use const projects = await this.consoleCLI.getProjects(orgId) if (projects.find(project => project.name === projectDetails.name)) { diff --git a/src/commands/console/project/list.js b/src/commands/console/project/list.js index f25bfe6..3140a3e 100644 --- a/src/commands/console/project/list.js +++ b/src/commands/console/project/list.js @@ -27,7 +27,6 @@ class ListCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const projects = await this.getConsoleOrgProjects(orgId) if (flags.json) { diff --git a/src/commands/console/project/select.js b/src/commands/console/project/select.js index d839e38..b0e8845 100644 --- a/src/commands/console/project/select.js +++ b/src/commands/console/project/select.js @@ -29,7 +29,6 @@ class SelectCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId) const project = await this.selectProjectInteractive(orgId, args.projectIdOrName) this.setConfig(CONFIG_KEYS.PROJECT, project) diff --git a/src/commands/console/publickey/delete.js b/src/commands/console/publickey/delete.js index bbbc792..4c91545 100644 --- a/src/commands/console/publickey/delete.js +++ b/src/commands/console/publickey/delete.js @@ -41,7 +41,6 @@ class DeleteCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId) const consoleConfig = await this.consoleCLI.getWorkspaceConfig(orgId, projectId, workspaceId) const project = consoleConfig.project diff --git a/src/commands/console/publickey/list.js b/src/commands/console/publickey/list.js index 17e489d..29c3d34 100644 --- a/src/commands/console/publickey/list.js +++ b/src/commands/console/publickey/list.js @@ -43,7 +43,6 @@ class ListCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const consoleConfig = await this.consoleCLI.getWorkspaceConfig(orgId, projectId, workspaceId) const project = consoleConfig.project diff --git a/src/commands/console/publickey/upload.js b/src/commands/console/publickey/upload.js index 4830739..2d2c8b6 100644 --- a/src/commands/console/publickey/upload.js +++ b/src/commands/console/publickey/upload.js @@ -53,7 +53,6 @@ class UploadAndBindCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const consoleConfig = await this.consoleCLI.getWorkspaceConfig(orgId, projectId, workspaceId) const project = consoleConfig.project diff --git a/src/commands/console/workspace/api/add.js b/src/commands/console/workspace/api/add.js index 1981710..c469c56 100644 --- a/src/commands/console/workspace/api/add.js +++ b/src/commands/console/workspace/api/add.js @@ -199,7 +199,6 @@ class AddCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const projects = await this.consoleCLI.getProjects(orgId) const project = projects.find(p => p.name === flags.projectName) if (!project) { diff --git a/src/commands/console/workspace/api/list.js b/src/commands/console/workspace/api/list.js index f506417..09ba460 100644 --- a/src/commands/console/workspace/api/list.js +++ b/src/commands/console/workspace/api/list.js @@ -28,7 +28,6 @@ class ListCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const projects = await this.consoleCLI.getProjects(orgId) const project = projects.find(p => p.name === flags.projectName) if (!project) { diff --git a/src/commands/console/workspace/create.js b/src/commands/console/workspace/create.js index 7d0207e..1610b46 100644 --- a/src/commands/console/workspace/create.js +++ b/src/commands/console/workspace/create.js @@ -46,7 +46,6 @@ class CreateCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) // resolve project by name to project id const projects = await this.consoleCLI.getProjects(orgId) const project = projects.find(p => p.name === flags.projectName) diff --git a/src/commands/console/workspace/download.js b/src/commands/console/workspace/download.js index 21da32b..f2b8ba3 100644 --- a/src/commands/console/workspace/download.js +++ b/src/commands/console/workspace/download.js @@ -45,7 +45,6 @@ class DownloadCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId) const consoleConfig = await this.consoleCLI.getWorkspaceConfig(orgId, projectId, workspaceId) let fileName = 'console.json' diff --git a/src/commands/console/workspace/list.js b/src/commands/console/workspace/list.js index 38281c6..c4a50c7 100644 --- a/src/commands/console/workspace/list.js +++ b/src/commands/console/workspace/list.js @@ -37,7 +37,6 @@ class ListCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId, flags.json || flags.yml) const workspaces = await this.getConsoleProjectWorkspaces(orgId, projectId) if (flags.json) { diff --git a/src/commands/console/workspace/select.js b/src/commands/console/workspace/select.js index b04f5c7..1d34d2c 100644 --- a/src/commands/console/workspace/select.js +++ b/src/commands/console/workspace/select.js @@ -36,7 +36,6 @@ class SelectCommand extends ConsoleCommand { await this.initSdk() try { - await this.ensureDevTermAccepted(this.consoleCLI, orgId) const workspace = await this.selectWorkspaceInteractive(orgId, projectId, args.workspaceIdOrName) const obj = { diff --git a/test/commands/console/api/list.test.js b/test/commands/console/api/list.test.js index 90059af..b4ec9fc 100644 --- a/test/commands/console/api/list.test.js +++ b/test/commands/console/api/list.test.js @@ -37,11 +37,7 @@ const mockEnabledServices = [ ] const mockConsoleCLIInstance = { - getEnabledServicesForOrg: jest.fn().mockResolvedValue(mockEnabledServices), - checkDevTermsForOrg: jest.fn().mockResolvedValue(true), - getDevTermsForOrg: jest.fn().mockResolvedValue({ text: 'terms' }), - acceptDevTermsForOrg: jest.fn().mockResolvedValue(true), - prompt: { promptConfirm: jest.fn().mockResolvedValue(true) } + getEnabledServicesForOrg: jest.fn().mockResolvedValue(mockEnabledServices) } jest.mock('@adobe/aio-cli-lib-console', () => { diff --git a/test/commands/console/index.test.js b/test/commands/console/index.test.js index 451b959..a9e3f9e 100644 --- a/test/commands/console/index.test.js +++ b/test/commands/console/index.test.js @@ -227,81 +227,4 @@ describe('ConsoleCommand', () => { expect(config.delete).toHaveBeenCalledWith(CONFIG_KEYS.CONSOLE) }) }) - - describe('ensureDevTermAccepted', () => { - let mockConsoleCLI - - beforeEach(() => { - mockConsoleCLI = { - checkDevTermsForOrg: jest.fn().mockResolvedValue(true), - getDevTermsForOrg: jest.fn().mockResolvedValue({ text: 'Developer Terms text' }), - acceptDevTermsForOrg: jest.fn().mockResolvedValue(true), - prompt: { promptConfirm: jest.fn().mockResolvedValue(true) } - } - command.error = jest.fn((msg) => { throw new Error(msg) }) - command.log = jest.fn() - }) - - test('no-op when terms already accepted', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(true) - await command.ensureDevTermAccepted(mockConsoleCLI, 'org-1') - expect(mockConsoleCLI.checkDevTermsForOrg).toHaveBeenCalledWith('org-1') - expect(mockConsoleCLI.getDevTermsForOrg).not.toHaveBeenCalled() - expect(mockConsoleCLI.prompt.promptConfirm).not.toHaveBeenCalled() - expect(mockConsoleCLI.acceptDevTermsForOrg).not.toHaveBeenCalled() - expect(command.log).not.toHaveBeenCalled() - }) - - test('errors fast when terms not accepted and skipPrompts=true', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(false) - await expect(command.ensureDevTermAccepted(mockConsoleCLI, 'org-1', true)) - .rejects.toThrow(/Developer Terms of Service have not been accepted/) - expect(mockConsoleCLI.getDevTermsForOrg).not.toHaveBeenCalled() - expect(mockConsoleCLI.prompt.promptConfirm).not.toHaveBeenCalled() - }) - - test('errors when user declines the terms', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(false) - mockConsoleCLI.prompt.promptConfirm.mockResolvedValue(false) - await expect(command.ensureDevTermAccepted(mockConsoleCLI, 'org-1')) - .rejects.toThrow('The Developer Terms of Service were declined') - expect(mockConsoleCLI.getDevTermsForOrg).toHaveBeenCalled() - expect(mockConsoleCLI.acceptDevTermsForOrg).not.toHaveBeenCalled() - }) - - test('accepts terms programmatically when user confirms', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(false) - mockConsoleCLI.prompt.promptConfirm.mockResolvedValue(true) - mockConsoleCLI.acceptDevTermsForOrg.mockResolvedValue(true) - await command.ensureDevTermAccepted(mockConsoleCLI, 'org-1') - expect(mockConsoleCLI.acceptDevTermsForOrg).toHaveBeenCalledWith('org-1') - expect(command.log).toHaveBeenCalledWith(expect.stringContaining('successfully accepted')) - }) - - test('errors when accept call returns false', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(false) - mockConsoleCLI.prompt.promptConfirm.mockResolvedValue(true) - mockConsoleCLI.acceptDevTermsForOrg.mockResolvedValue(false) - await expect(command.ensureDevTermAccepted(mockConsoleCLI, 'org-1')) - .rejects.toThrow('The Developer Terms of Service could not be accepted') - }) - - test('includes the terms URL in the prompt', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(false) - mockConsoleCLI.getDevTermsForOrg.mockResolvedValue({ text: '\n Developer Terms text \n' }) - await command.ensureDevTermAccepted(mockConsoleCLI, 'org-1') - const promptArg = mockConsoleCLI.prompt.promptConfirm.mock.calls[0][0] - expect(promptArg).toContain('https://www.adobe.com/go/developer-terms') - expect(promptArg).toContain('Developer Terms text') - expect(promptArg).toMatch(/^Developer Terms text\n\nYou have not accepted/) - }) - - test('handles missing terms text in the prompt', async () => { - mockConsoleCLI.checkDevTermsForOrg.mockResolvedValue(false) - mockConsoleCLI.getDevTermsForOrg.mockResolvedValue({}) - await command.ensureDevTermAccepted(mockConsoleCLI, 'org-1') - const promptArg = mockConsoleCLI.prompt.promptConfirm.mock.calls[0][0] - expect(promptArg).toContain('You have not accepted the Developer Terms of Service.') - }) - }) }) diff --git a/test/commands/console/open.test.js b/test/commands/console/open.test.js index 4543aeb..4014a45 100644 --- a/test/commands/console/open.test.js +++ b/test/commands/console/open.test.js @@ -11,7 +11,7 @@ governing permissions and limitations under the License. const TestCommand = require('../../../src/commands/console/open') const config = require('@adobe/aio-lib-core-config') -const { PROD_ENV, STAGE_ENV } = require('@adobe/aio-lib-env') +const { STAGE_ENV } = require('@adobe/aio-lib-env') const mockOpen = jest.fn() jest.unstable_mockModule('open', () => ({ @@ -25,7 +25,6 @@ beforeAll(() => { ORIGINAL_AIO_CLI_ENV = process.env.AIO_CLI_ENV }) beforeEach(() => { - process.env.AIO_CLI_ENV = PROD_ENV config.get.mockReset() mockOpen.mockReset() command = new TestCommand([]) diff --git a/test/commands/console/project/create.test.js b/test/commands/console/project/create.test.js index 582c951..c19fd1f 100644 --- a/test/commands/console/project/create.test.js +++ b/test/commands/console/project/create.test.js @@ -26,11 +26,7 @@ const mockProject = { const mockConsoleCLIInstance = { getProjects: jest.fn().mockResolvedValue([]), - createProject: jest.fn().mockResolvedValue(mockProject), - checkDevTermsForOrg: jest.fn().mockResolvedValue(true), - getDevTermsForOrg: jest.fn().mockResolvedValue({ text: 'terms' }), - acceptDevTermsForOrg: jest.fn().mockResolvedValue(true), - prompt: { promptConfirm: jest.fn().mockResolvedValue(true) } + createProject: jest.fn().mockResolvedValue(mockProject) } jest.mock('@adobe/aio-cli-lib-console', () => ({ @@ -50,7 +46,6 @@ describe('console:project:create', () => { mockConsoleCLIInstance.createProject = jest.fn().mockResolvedValue(mockProject) mockConsoleCLIInstance.getProjects.mockReset() mockConsoleCLIInstance.getProjects = jest.fn().mockResolvedValue([]) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) }) afterEach(() => { diff --git a/test/commands/console/project/list.test.js b/test/commands/console/project/list.test.js index ac2ce93..8b636ae 100644 --- a/test/commands/console/project/list.test.js +++ b/test/commands/console/project/list.test.js @@ -44,10 +44,6 @@ const mockConsoleCLIInstance = {} */ function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getProjects = jest.fn().mockResolvedValue(projects) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance), @@ -121,15 +117,6 @@ describe('console:project:list', () => { expect(mockConsoleCLIInstance.getProjects).toHaveBeenCalledWith('1001') }) - test('should not prompt for developer terms when returning projects as json', async () => { - mockConsoleCLIInstance.checkDevTermsForOrg.mockResolvedValue(false) - command.argv = ['--orgId', '1001', '--json'] - - await expect(command.run()).rejects.toThrow('Developer Terms of Service have not been accepted') - expect(mockConsoleCLIInstance.prompt.promptConfirm).not.toHaveBeenCalled() - expect(mockConsoleCLIInstance.getProjects).not.toHaveBeenCalled() - }) - test('should return list of projects yaml', async () => { command.argv = ['--orgId', '1001', '--yml'] await expect(command.run()).resolves.not.toThrow() diff --git a/test/commands/console/project/select.test.js b/test/commands/console/project/select.test.js index 8ce85ae..8745f3c 100644 --- a/test/commands/console/project/select.test.js +++ b/test/commands/console/project/select.test.js @@ -42,10 +42,6 @@ const mockConsoleCLIInstance = {} function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getProjects = jest.fn().mockResolvedValue(projects) mockConsoleCLIInstance.promptForSelectProject = jest.fn().mockResolvedValue(selectedProject) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ diff --git a/test/commands/console/publickey/delete.test.js b/test/commands/console/publickey/delete.test.js index 1604872..80ce0b0 100644 --- a/test/commands/console/publickey/delete.test.js +++ b/test/commands/console/publickey/delete.test.js @@ -49,10 +49,6 @@ function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getWorkspaceConfig = jest.fn().mockResolvedValue(consoleConfig) mockConsoleCLIInstance.getBindingsForWorkspace = jest.fn().mockResolvedValue([binding1, binding2]) mockConsoleCLIInstance.deleteBindingFromWorkspace = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance), diff --git a/test/commands/console/publickey/list.test.js b/test/commands/console/publickey/list.test.js index f6d4f05..9f02b12 100644 --- a/test/commands/console/publickey/list.test.js +++ b/test/commands/console/publickey/list.test.js @@ -50,10 +50,6 @@ const mockConsoleCLIInstance = {} function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getWorkspaceConfig = jest.fn().mockResolvedValue(consoleConfig) mockConsoleCLIInstance.getBindingsForWorkspace = jest.fn().mockResolvedValue(bindings) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance), diff --git a/test/commands/console/publickey/upload.test.js b/test/commands/console/publickey/upload.test.js index 04ef92a..7b58267 100644 --- a/test/commands/console/publickey/upload.test.js +++ b/test/commands/console/publickey/upload.test.js @@ -51,10 +51,6 @@ function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getBindingsForWorkspace = jest.fn().mockResolvedValue([binding1]) mockConsoleCLIInstance.uploadAndBindCertificateToWorkspace = jest.fn().mockResolvedValue(binding2) mockConsoleCLIInstance.getCertificateFingerprint = jest.fn().mockResolvedValue({ certificateFingerprint: 'cf2' }) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance), diff --git a/test/commands/console/workspace/api/add.test.js b/test/commands/console/workspace/api/add.test.js index 0fce647..2c9f7f3 100644 --- a/test/commands/console/workspace/api/add.test.js +++ b/test/commands/console/workspace/api/add.test.js @@ -46,11 +46,7 @@ const mockConsoleCLIInstance = { getWorkspaces: jest.fn().mockResolvedValue([mockWorkspace]), getEnabledServicesForOrg: jest.fn().mockResolvedValue(mockEnabledServices), getServicePropertiesFromWorkspaceWithCredentialType: jest.fn().mockResolvedValue([]), - subscribeToServicesWithCredentialType: jest.fn().mockResolvedValue(mockSubscribeResponse), - checkDevTermsForOrg: jest.fn().mockResolvedValue(true), - getDevTermsForOrg: jest.fn().mockResolvedValue({ text: 'terms' }), - acceptDevTermsForOrg: jest.fn().mockResolvedValue(true), - prompt: { promptConfirm: jest.fn().mockResolvedValue(true) } + subscribeToServicesWithCredentialType: jest.fn().mockResolvedValue(mockSubscribeResponse) } jest.mock('@adobe/aio-cli-lib-console', () => ({ diff --git a/test/commands/console/workspace/api/list.test.js b/test/commands/console/workspace/api/list.test.js index 2d4a5b4..a89ae15 100644 --- a/test/commands/console/workspace/api/list.test.js +++ b/test/commands/console/workspace/api/list.test.js @@ -40,11 +40,7 @@ const mockConsoleCLIInstance = { getProjects: jest.fn().mockResolvedValue([mockProject]), getWorkspaces: jest.fn().mockResolvedValue([mockWorkspace]), getEnabledServicesForOrg: jest.fn().mockResolvedValue(mockEnabledServices), - getServicePropertiesFromWorkspaceWithCredentialType: jest.fn().mockResolvedValue(mockSubscribedServiceProperties), - checkDevTermsForOrg: jest.fn().mockResolvedValue(true), - getDevTermsForOrg: jest.fn().mockResolvedValue({ text: 'terms' }), - acceptDevTermsForOrg: jest.fn().mockResolvedValue(true), - prompt: { promptConfirm: jest.fn().mockResolvedValue(true) } + getServicePropertiesFromWorkspaceWithCredentialType: jest.fn().mockResolvedValue(mockSubscribedServiceProperties) } jest.mock('@adobe/aio-cli-lib-console', () => { diff --git a/test/commands/console/workspace/create.test.js b/test/commands/console/workspace/create.test.js index c49f29f..ef029b9 100644 --- a/test/commands/console/workspace/create.test.js +++ b/test/commands/console/workspace/create.test.js @@ -25,11 +25,7 @@ const mockWorkspace = { const mockConsoleCLIInstance = { getProjects: jest.fn().mockResolvedValue([mockProject]), getWorkspaces: jest.fn().mockResolvedValue([]), - createWorkspace: jest.fn().mockResolvedValue(mockWorkspace), - checkDevTermsForOrg: jest.fn().mockResolvedValue(true), - getDevTermsForOrg: jest.fn().mockResolvedValue({ text: 'terms' }), - acceptDevTermsForOrg: jest.fn().mockResolvedValue(true), - prompt: { promptConfirm: jest.fn().mockResolvedValue(true) } + createWorkspace: jest.fn().mockResolvedValue(mockWorkspace) } jest.mock('@adobe/aio-cli-lib-console', () => ({ @@ -50,7 +46,6 @@ describe('console:workspace:create', () => { mockConsoleCLIInstance.getWorkspaces.mockResolvedValue([]) mockConsoleCLIInstance.getProjects.mockReset() mockConsoleCLIInstance.getProjects.mockResolvedValue([mockProject]) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) }) afterEach(() => { diff --git a/test/commands/console/workspace/download.test.js b/test/commands/console/workspace/download.test.js index a494827..9e6231b 100644 --- a/test/commands/console/workspace/download.test.js +++ b/test/commands/console/workspace/download.test.js @@ -27,10 +27,6 @@ const mockConsoleCLIInstance = {} function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getWorkspaceConfig = jest.fn() mockConsoleCLIInstance.getWorkspaceConfig.mockResolvedValue(fakeConfig) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance), diff --git a/test/commands/console/workspace/list.test.js b/test/commands/console/workspace/list.test.js index a352f9c..0db4b5c 100644 --- a/test/commands/console/workspace/list.test.js +++ b/test/commands/console/workspace/list.test.js @@ -24,10 +24,6 @@ const mockConsoleCLIInstance = {} /** @private */ function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getWorkspaces = jest.fn().mockResolvedValue(workspaces) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance), diff --git a/test/commands/console/workspace/select.test.js b/test/commands/console/workspace/select.test.js index 566e9c6..03b4d7c 100644 --- a/test/commands/console/workspace/select.test.js +++ b/test/commands/console/workspace/select.test.js @@ -25,10 +25,6 @@ const mockConsoleCLIInstance = {} function setDefaultMockConsoleCLI () { mockConsoleCLIInstance.getWorkspaces = jest.fn().mockResolvedValue(workspaces) mockConsoleCLIInstance.promptForSelectWorkspace = jest.fn().mockResolvedValue(selectedWorkspace) - mockConsoleCLIInstance.checkDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.getDevTermsForOrg = jest.fn().mockResolvedValue({ text: 'terms' }) - mockConsoleCLIInstance.acceptDevTermsForOrg = jest.fn().mockResolvedValue(true) - mockConsoleCLIInstance.prompt = { promptConfirm: jest.fn().mockResolvedValue(true) } } jest.mock('@adobe/aio-cli-lib-console', () => ({ init: jest.fn().mockResolvedValue(mockConsoleCLIInstance),