Skip to content

Commit

Permalink
fix build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
simenandre committed Jul 13, 2023
1 parent 4fa6c2d commit e6dd39c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/__tests__/stdout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('stdout', () => {

beforeEach(async () => {
output = jest.fn();
const app = await createApp({ output });
const app = await createApp({ type: 'stdout', output });
service = app.get<SlackService>(SlackService);
});

Expand Down
8 changes: 5 additions & 3 deletions src/slack.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LogSync } from '@google-cloud/logging';
import { Inject, Injectable } from '@nestjs/common';
import type { ChatPostMessageArguments, WebClient } from '@slack/web-api';
import { fetch } from 'node-fetch';
import fetch from 'node-fetch';
import type { SlackBlockDto } from 'slack-block-builder';
import invariant from 'ts-invariant';
import {
Expand Down Expand Up @@ -133,7 +133,7 @@ export class SlackService<C = Channels> {
}

private async runWebhookRequest(req: SlackMessageOptions) {
invariant(this.options.type === 'webhook');
invariant(this.options.type === 'webhook', 'expected type to be webhook');

if ('channels' in this.options) {
const {
Expand Down Expand Up @@ -162,9 +162,11 @@ export class SlackService<C = Channels> {
method: 'POST',
body: JSON.stringify(slackRequest),
});

return;
}

invariant('url' in this.options);
invariant('url' in this.options, 'expected url to be defined');

// TODO: Replace with undici?
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
Expand Down

0 comments on commit e6dd39c

Please sign in to comment.