Skip to content

Commit 562e27d

Browse files
init commit
0 parents  commit 562e27d

File tree

9 files changed

+5987
-0
lines changed

9 files changed

+5987
-0
lines changed

.env.sample

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
API_KEY=YOUR_OEPNWEATHER_API_KEY

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Node.js dependencies
2+
node_modules/
3+
4+
# dotenv environment files
5+
.env
6+
7+
# Logs
8+
logs
9+
*.log
10+
npm-debug.log*
11+
12+
# Jest cache and coverage
13+
coverage/
14+
jest/
15+
16+
# Operating system files
17+
.DS_Store
18+
Thumbs.db
19+
20+
# VSCode settings
21+
.vscode/

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Geolocation Utility - Fetch Coding Exercise (SDET)
2+
3+
## Description
4+
This command-line utility fetches latitude, longitude, and location details for U.S. cities or zip codes using the [OpenWeather Geocoding API](https://openweathermap.org/api/geocoding-api). It supports input as either city/state combinations or zip codes, and allows multiple locations at once.
5+
6+
## Features
7+
- Retrieve geolocation data (latitude, longitude, and place name) based on city/state or zip code.
8+
- Supports multiple location inputs.
9+
- Comprehensive QA testing including integration, performance, and rate-limiting tests.
10+
11+
## Requirements
12+
- Node.js (v14.x or later)
13+
- NPM (v6.x or later)
14+
15+
## Setup
16+
17+
1. **Clone the repository:**
18+
```bash
19+
git clone <your-repo-url>
20+
cd fetch-geoloc-qa-util
21+
```
22+
23+
2. **Install dependencies:**
24+
```bash
25+
npm install
26+
```
27+
28+
3. **Set up environment variables:**
29+
- Create a `.env` file in the root directory:
30+
```bash
31+
touch .env
32+
```
33+
- Add your OpenWeather API key to the `.env` file:
34+
```bash
35+
API_KEY=YOUR_OEPNWEATHER_API_KEY
36+
```
37+
38+
## Usage
39+
The utility supports two types of location input:
40+
1. City/State combination: `"Madison, WI"`
41+
2. Zip code: `"12345"`
42+
43+
**Example usage:**
44+
```bash
45+
node src/index.js "Madison, WI" "12345" "Chicago, IL"
46+
```
47+
48+
The utility will output the latitude, longitude, and place name for each location.
49+
50+
## Running Tests
51+
52+
We have set up integration, performance, and rate-limiting tests to ensure the utility works as expected.
53+
54+
### Integration Tests:
55+
- To run integration tests:
56+
```bash
57+
npm test
58+
```
59+
60+
### Performance Tests:
61+
- Performance tests ensure response time is optimal (under 2 seconds):
62+
```bash
63+
npm run performance
64+
```
65+
66+
## CI/CD Integration
67+
This project uses GitHub Actions for Continuous Integration (CI) to automatically run tests on every push. The workflow is defined in `.github/workflows/test.yml`.
68+
69+
## Project Structure
70+
```
71+
/fetch-geoloc-qa-util
72+
|-- src/
73+
|-- index.js # Main script
74+
|-- utils.js # Helper functions for fetching API data
75+
|-- tests/
76+
|-- integration.test.js # Integration tests
77+
|-- performance.test.js # Performance tests
78+
|-- .env # API key configuration (not included in repo)
79+
|-- .gitignore # Ignoring node_modules, env, etc.
80+
|-- package.json # Project dependencies and scripts
81+
|-- README.md # Project documentation
82+
|-- .github/
83+
|-- workflows/
84+
|-- test.yml # CI/CD config
85+
```
86+
87+
## Future Improvements
88+
- **More comprehensive performance testing**: Test with larger datasets.
89+
- **Expand unit testing**: Add unit tests for error handling and edge cases.
90+
- **Additional rate-limiting tests**: Extend to simulate production-level API calls.

0 commit comments

Comments
 (0)