<commit_before># Firebase Test SDK for Cloud Functions

The `firebase-functions-test` is unit testing library for Cloud Functions for Firebase. It is a companion to [firebase-functions](https://github.com/Firebase/firebase-functions).

_NOTE: This library can only be used with `firebase-functions` v2.0.0 or above._

## Learn more

Learn more about the SDK [Firebase documentation](https://firebase.google.com/docs/functions/unit-testing) or [check out sample unit tests](https://github.com/firebase/functions-samples/blob/master/quickstarts/uppercase/functions).

## Contributing

To contribute a change, [check out the contributing guide](.github/CONTRIBUTING.md).

## License

© Google, 2018. Licensed under [The MIT License](LICENSE).<commit_msg>Update to README.md to include more samples to get started (#143)<commit_after># Firebase Test SDK for Cloud Functions

The `firebase-functions-test` is unit testing library for Cloud Functions for Firebase. It is a companion to [firebase-functions](https://github.com/Firebase/firebase-functions).

_NOTE: This library can only be used with `firebase-functions` v3.20.1 or above._

## Usage

1. Write some Firebase Functions
2. With your testing framework of choice, write a unit-test that imports your Firebase Functions.
3. `wrap` your Firebase Functions. You can invoke the Firebase Function's handler by invoking the `wrap` call.

Eg.

```typescript
import {myFirebaseFunction} from "../index"; // Your Firebase Functions
import firebaseFunctionsTest from "firebase-functions-test";

// Extracting `wrap` out of the lazy-loaded features
const {wrap} = firebaseFunctionsTest();

// `jest-ts` example
test('my unit test', () => {
  const wrappedFirebaseFunction = wrap(myFirebaseFunction);

  // Invoke the firebase function
  wrappedFirebaseFunction();

  // Invoke the firebase function with CloudEvent overrides
  wrappedFirebaseFunction({data: {arbitrary: 'values'}});
});
```

## Examples

* [Unit Testing Gen-1 Cloud Functions using Mocha](https://github.com/firebase/functions-samples/tree/main/quickstarts/uppercase/functions)
* [Unit Testing Gen-2 Cloud Functions using Mocha](https://github.com/firebase/functions-samples/tree/main/2nd-gen/test-functions-mocha/functions)
* [Unit Testing Gen-2 Cloud Functions using Jest](https://github.com/firebase/functions-samples/tree/main/2nd-gen/test-functions-jest/functions)
* [Unit Testing Gen-2 Cloud Functions using Jest-Ts](https://github.com/firebase/functions-samples/tree/main/2nd-gen/test-functions-jest-ts/functions)

## Learn more

Learn more about unit testing Cloud Functions [here](https://firebase.google.com/docs/functions/unit-testing).

## Contributing

To contribute a change, [check out the contributing guide](.github/CONTRIBUTING.md).

## License

© Google, 2018. Licensed under [The MIT License](LICENSE).
{'fraction_non_alphanumeric': 0.11436639604659371, 'fraction_numerical': 0.009883515707730321, 'mean_word_length': 4.99154334038055, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 9, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1285866', 'n_tokens_mistral': 849, 'n_tokens_neox': 795, 'n_words': 257}