An open API service indexing awesome lists of open source software.

https://github.com/zapkub/mock-n-roll

🀘🏼🎸 Enjoy the Typescript interface mocking generator !!
https://github.com/zapkub/mock-n-roll

generator interface mock mockery typescript

Last synced: 2 months ago
JSON representation

🀘🏼🎸 Enjoy the Typescript interface mocking generator !!

Awesome Lists containing this project

README

        

# Mock 'N' Roll 🀘🏼
The Typescript interface mock generator. It will useful for Dependency Injection, Inversion and also Clean architecture onion layer testing and more !

# Usage
```
mnroll --path --out --name
```

# Basic test
```typescript
// Source interface
export interface User {
id: string
name: string
}
export interface UserRepository {
randomUser(): User
}
```

```typescript
// Test
it('Should return promise of object type correctly', async () => {
const u = new UserRepository()
u.mocks.randomUser().toReturn({ id: 'TEST', name: 'TEST' })
const result = u.randomUser()
expect(result).toEqual({ id: 'TEST', name: 'TEST' })
})
```

# License
MIT.