Skip to content

Commit 276afe7

Browse files
Fix Slack data fetcher script with new implementation (#288)
* Fix Slack data fetcher script with new implementation Co-Authored-By: Hal Seki <[email protected]> * Update README and remove old script file Co-Authored-By: Hal Seki <[email protected]> --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent d21b375 commit 276afe7

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

integration-tests/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ integration-tests/
1414
│ ├── e2e/ # End-to-end tests with Playwright
1515
│ └── api/ # API tests with pytest
1616
└── utils/ # Utility functions for tests
17-
└── slack-data-fetcher.js # Script to fetch Slack data for test generation
17+
└── fetch-slack-data.js # Script to fetch Slack data for test generation
1818
```
1919

2020
## Setup Instructions
@@ -93,20 +93,20 @@ For generating test data from real Slack workspaces, use the data fetcher script
9393
npm install
9494

9595
# Run with a Slack API token
96-
./utils/slack-data-fetcher.js --token "xoxb-your-token"
96+
./utils/fetch-slack-data.js --token "xoxb-your-token"
9797

9898
# Or use environment variables
9999
export SLACK_TOKEN="xoxb-your-token"
100-
./utils/slack-data-fetcher.js
100+
./utils/fetch-slack-data.js
101101

102102
# Customize the number of items to fetch
103-
./utils/slack-data-fetcher.js --channels 5 --messages 10 --users 15
103+
./utils/fetch-slack-data.js --channels 5 --messages 10 --users 15
104104

105105
# Specify a custom output directory
106-
./utils/slack-data-fetcher.js --output /path/to/output/dir
106+
./utils/fetch-slack-data.js --output /path/to/output/dir
107107

108108
# Disable data sanitization (not recommended for commits)
109-
./utils/slack-data-fetcher.js --no-sanitize
109+
./utils/fetch-slack-data.js --no-sanitize
110110
```
111111

112112
The script will fetch:

integration-tests/utils/slack-data-fetcher.js renamed to integration-tests/utils/fetch-slack-data.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
#!/usr/bin/env node
22

33
/**
4-
* Slack Data Fetcher
4+
* Fetch Slack Data
55
*
66
* This script fetches data from the Slack API and saves it as JSON files
77
* for use by the mock Slack API service in integration tests.
88
*/
99

1010
const fs = require('fs');
1111
const path = require('path');
12-
const WebClient = require('@slack/web-api').WebClient;
13-
const program = require('commander').program;
14-
const chalk = require('chalk');
12+
const slackWebApi = require('@slack/web-api');
13+
const commander = require('commander');
1514
require('dotenv').config();
1615

16+
const WebClient = slackWebApi.WebClient;
17+
1718
const DEFAULT_OUTPUT_DIR = path.join(__dirname, '../mocks/slack-api/data');
1819
const DEFAULT_CHANNEL_LIMIT = 10;
1920
const DEFAULT_MESSAGE_LIMIT = 20;
2021
const DEFAULT_USER_LIMIT = 20;
2122

23+
const program = commander.program;
2224
program
2325
.version('1.0.0')
2426
.description('Fetch Slack data for test data generation')
@@ -35,10 +37,10 @@ program.parse(process.argv);
3537
const options = program.opts();
3638

3739
const log = {
38-
info: (msg) => console.log(chalk.blue(`[INFO] ${msg}`)),
39-
warn: (msg) => console.log(chalk.yellow(`[WARN] ${msg}`)),
40-
error: (msg) => console.error(chalk.red(`[ERROR] ${msg}`)),
41-
success: (msg) => console.log(chalk.green(`[SUCCESS] ${msg}`))
40+
info: (msg) => console.log(`[INFO] ${msg}`),
41+
warn: (msg) => console.log(`[WARN] ${msg}`),
42+
error: (msg) => console.error(`[ERROR] ${msg}`),
43+
success: (msg) => console.log(`[SUCCESS] ${msg}`)
4244
};
4345

4446
const token = options.token || process.env.SLACK_TOKEN;

0 commit comments

Comments
 (0)