microsoft-onedrive-mock
v1.0.5
Published
Mock-Server that simulates being Microsoft OneDrive. Used for testing.
Downloads
25,571
Maintainers
Readme
microsoft-onedrive-mock
Installation
npm install microsoft-onedrive-mockUsage
import { startServer } from 'microsoft-onedrive-mock';
// start the server
const port = 3000;
const server = startServer(port);
// Read the drive root
const readResponse = await fetch(`http://localhost:3000/v1.0/me/drive/root`, {
method: 'GET',
headers: {
'Authorization': 'Bearer valid-token'
}
});
const folderContent = await readResponse.json();
console.log('Read Root:', folderContent);
// Stop the server
server.close();
Tech
- TypeScript
- Express
- Vitest
Browser Testing
To run tests inside a headless browser (Chromium):
npm run test:browserReal Microsoft Graph API Testing
To run tests against the real Microsoft Graph / OneDrive API instead of the mock:
- Create a
.ENVfile (see.ENV_EXAMPLE):TEST_TARGET=real ONEDRIVE_TOKEN=your-access-token - You can generate a valid
ONEDRIVE_TOKENquickly by running the included login script and following the browser prompts:npm run example:login - Run tests:
npm run test:real
Contributing
GitHub issues for this project are closed. If you find a bug, please create a Pull Request with a test case reproducing the issue.
