Skip to content

Commit

Permalink
Fix typescript error
Browse files Browse the repository at this point in the history
Signed-off-by: Drew Hill <[email protected]>
  • Loading branch information
arhill05 committed Aug 4, 2023
1 parent d87817f commit 536c758
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
1 change: 1 addition & 0 deletions dist-types/src/actions/example/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { createSendSlackMessageViaWebhookAction } from './send-slack-message';
12 changes: 12 additions & 0 deletions dist-types/src/actions/example/send-slack-message.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Config } from '@backstage/config';
/**
* Creates a `slack:sendMessage` Scaffolder action.
*
* @public
*/
export declare function createSendSlackMessageViaWebhookAction(options: {
config: Config;
}): import("@backstage/plugin-scaffolder-node").TemplateAction<{
message: string;
webhookUrl?: string | undefined;
}, import("@backstage/types").JsonObject>;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
1 change: 1 addition & 0 deletions dist-types/src/actions/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './example';
7 changes: 7 additions & 0 deletions dist-types/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/***/
/**
* The slack module for @backstage/plugin-scaffolder-backend.
*
* @packageDocumentation
*/
export * from './actions';
1 change: 1 addition & 0 deletions dist-types/tsconfig.tsbuildinfo

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/actions/example/send-slack-message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('slack:sendMessage', () => {
it('should throw error if webhookUrl is not defined', async () => {
const action = createSendSlackMessageViaWebhookAction({
config: {
getOptionalString: (key: string): string | undefined => undefined,
getOptionalString: (_key: string): string | undefined => undefined,
} as Config,
});

Expand All @@ -48,7 +48,7 @@ describe('slack:sendMessage', () => {
it('should send to config webhook URL if provided', async () => {
const action = createSendSlackMessageViaWebhookAction({
config: {
getOptionalString: (key: string): string | undefined =>
getOptionalString: (_key: string): string | undefined =>
'https://example.com',
} as Config,
});
Expand All @@ -74,7 +74,7 @@ describe('slack:sendMessage', () => {
it('should prefer webhook url from config if provided in input', async () => {
const action = createSendSlackMessageViaWebhookAction({
config: {
getOptionalString: (key: string): string | undefined =>
getOptionalString: (_key: string): string | undefined =>
'https://example.com',
} as Config,
});
Expand All @@ -101,7 +101,7 @@ describe('slack:sendMessage', () => {
it('should use the webhook url on input if config value is not present', async () => {
const action = createSendSlackMessageViaWebhookAction({
config: {
getOptionalString: (key: string): string | undefined => undefined,
getOptionalString: (_key: string): string | undefined => undefined,
} as Config,
});

Expand All @@ -127,7 +127,7 @@ describe('slack:sendMessage', () => {
it('should send message in proper format to webhook URL', async () => {
const action = createSendSlackMessageViaWebhookAction({
config: {
getOptionalString: (key: string): string | undefined =>
getOptionalString: (_key: string): string | undefined =>
'https://example.com',
} as Config,
});
Expand All @@ -154,7 +154,7 @@ describe('slack:sendMessage', () => {
it('should throw an error if result.status is not 200', async () => {
const action = createSendSlackMessageViaWebhookAction({
config: {
getOptionalString: (key: string): string | undefined =>
getOptionalString: (_key: string): string | undefined =>
'https://example.com',
} as Config,
});
Expand Down

0 comments on commit 536c758

Please sign in to comment.