# Avo and tests

It can be useful to have your Avo Codegen running as a part of your test suite.

To that end, Avo generated tracking libraries can be initialized with a `noop` flag
that disables network requests and only run data validation.

Below is an example of initializing Avo in a [jest](https://jestjs.io) test environment with JavaScript:

```js
describe('Avo', () => {
  var Avo;
  beforeAll(() => {
    Avo = require('./Avo');
    Avo.initAvo({ env: 'dev', noop: true, strict: true });
  });
  test('signupStart() with email property is valid', () => {
    Avo.signupCompleted({ email: 'test@test.com' });
  });
  test('signupStart() without email property throws', () => {
    expect(() => {
      Avo.signupCompleted();
    }).toThrow();
  });
});
```

The `noop` flag is supported in JavaScript, TypeScript, Reason, Java, Objective-C, Swift and Python.

### Unit tests in Kotlin and Swift

In the generated Avo file we provide wrapping interface/protocol with all the event methods.

```kotlin
public interface Avo {
    fun feedbackGiven(
        path: String,
        feedback: String
    )
}
```

```swift
public protocol AvoProtocol {
    func feedbackGiven(
        path: String,
        feedback: String
    )
}
```

We suggest to mock it in your tests and verify that desired method is called with particular parameters.
