@backstage/cli
Version:
CLI for developing Backstage plugins and apps
25 lines (20 loc) • 681 B
text/typescript
import { createExampleAction } from './example';
import {createMockActionContext} from '@backstage/plugin-scaffolder-node-test-utils'
describe('createExampleAction', () => {
it('should call action', async () => {
const action = createExampleAction();
await expect(action.handler(createMockActionContext({
input: {
myParameter: 'test',
},
}))).resolves.toBeUndefined()
});
it('should fail when passing foo', async () => {
const action = createExampleAction();
await expect(action.handler(createMockActionContext({
input: {
myParameter: 'foo',
},
}))).rejects.toThrow("myParameter cannot be 'foo'")
});
});