afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); process.exit.mockRestore(); });
describe('when provided issue option', () => { beforeAll(() => { spyOn(LINETokenOperation, 'issue').mockResolvedValue(true); }); it('returns help', async () => { await expect(LINETokenOperation.run({ issue: true })).resolves.toEqual( true ); expect(LINETokenOperation.issue).toHaveBeenCalled(); }); afterAll(() => { LINETokenOperation.issue.mockRestore(); }); });
describe('when run with remove operation', () => { beforeAll(() => { spyOn(LIFFCommand, 'getCommandLineArgs').mockReturnValue({ operation: 'remove', options: {}, _unknown: [] }); spyOn(LIFFRemoveOperation, 'run').mockResolvedValue(undefined); }); it('run correctly', async () => { await expect(LIFFCommand.cli()).resolves.toEqual(undefined); expect(LIFFRemoveOperation.run).toHaveBeenCalled(); }); afterAll(() => { LIFFCommand.getCommandLineArgs.mockRestore(); LIFFRemoveOperation.run.mockRestore(); }); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); });
describe('when provided revoke option', () => { beforeAll(() => { spyOn(LINETokenOperation, 'revoke').mockResolvedValue(true); }); it('returns help', async () => { await expect(LINETokenOperation.run({ revoke: true })).resolves.toEqual( true ); expect(LINETokenOperation.revoke).toHaveBeenCalled(); }); afterAll(() => { LINETokenOperation.revoke.mockRestore(); }); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); process.exit.mockRestore(); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); process.exit.mockRestore(); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); process.exit.mockRestore(); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); });
afterAll(() => { commandLineUsage.mockRestore(); unmock('command-line-usage'); ImageHelper.draw.mockRestore(); console.log.mockRestore(); });
describe('when run with get:spotlight operation', () => { beforeAll(() => { spyOn(LINETvCommand, 'getCommandLineArgs').mockReturnValue({ operation: 'get:spotlight', options: {}, _unknown: [] }); spyOn(LINETvGetSpotlightOperation, 'run').mockResolvedValue(undefined); }); it('run correctly', async () => { await expect(LINETvCommand.cli()).resolves.toEqual(undefined); expect(LINETvGetSpotlightOperation.run).toHaveBeenCalled(); }); afterAll(() => { LINETvCommand.getCommandLineArgs.mockRestore(); LINETvGetSpotlightOperation.run.mockRestore(); }); });
describe('when run with unlink operation', () => { beforeAll(() => { spyOn(RichmenuCommand, 'getCommandLineArgs').mockReturnValue({ operation: 'unlink', options: {}, _unknown: [] }); spyOn(RichmenuUnlinkOperation, 'run').mockResolvedValue(undefined); }); it('run correctly', async () => { await expect(RichmenuCommand.cli()).resolves.toEqual(undefined); expect(RichmenuUnlinkOperation.run).toHaveBeenCalled(); }); afterAll(() => { RichmenuCommand.getCommandLineArgs.mockRestore(); RichmenuUnlinkOperation.run.mockRestore(); }); });
describe('when run with get:devices operation', () => { beforeAll(() => { spyOn(ThingsCommand, 'getCommandLineArgs').mockReturnValue({ operation: 'get:devices', options: {}, _unknown: [] }); spyOn(ThingsGetDevicesOperation, 'run').mockResolvedValue(undefined); }); it('run correctly', async () => { await expect(ThingsCommand.cli()).resolves.toEqual(undefined); expect(ThingsGetDevicesOperation.run).toHaveBeenCalled(); }); afterAll(() => { ThingsCommand.getCommandLineArgs.mockRestore(); ThingsGetDevicesOperation.run.mockRestore(); }); });