react-native-integrate
Version:
Automate integration of additional code into React Native projects
30 lines (29 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const promptTask_1 = require("../../../tasks/promptTask");
const variables_1 = require("../../../variables");
const mock = jest.spyOn(require('../../../utils/runPrompt'), 'runPrompt');
describe('promptTask', () => {
it('should handle unexpected error', async () => {
mock.mockImplementationOnce(() => {
throw new Error('unexpected error');
});
const task = {
task: 'prompt',
actions: [
{
name: 'test',
text: 'test',
type: 'text',
},
],
};
await expect((0, promptTask_1.promptTask)({
configPath: 'path/to/config',
task: task,
packageName: 'test-package',
})).rejects.toThrowError('unexpected error');
expect(variables_1.variables.get('test')).toEqual('error');
mock.mockReset();
});
});