Skip to content

Commit

Permalink
Sse docs (#438)
Browse files Browse the repository at this point in the history
* first commit

Signed-off-by: ishaanj18 <ishaan454@gmail.com>

* added documentation

Signed-off-by: ishaanj18 <ishaan454@gmail.com>

* added changes to version_2.0.0_sidebar.json

Signed-off-by: ishaanj18 <ishaan454@gmail.com>

* updated samples-go-sse-svelte.md

Signed-off-by: ishaanj18 <ishaan454@gmail.com>

* [docs]: Added instructions for using npm to run the Docusaurus site locally (#423)

* docs(configuration): added example for handling nested JSON fields

Added example for handling nested JSON fields

Closes #1892

Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* docs: add instructions for using npm to run the Docusaurus site locally

Added instructions for using npm to run the Docusaurus site locally

Closes #2094

Signed-off-by: Gauri Bhandari <bhandarigauri923@gmail.com>
Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* docs: add instructions for using npm to run the Docusaurus site locally

Added note

Closes #2094

Signed-off-by: Gauri Bhandari <bhandarigauri923@gmail.com>
Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* Updated documentation to reflect npm migration

Revised the documentation to include instructions for using npm instead of yarn

Migration from using yarn to npm on docs website

Closes #2094

Signed-off-by: Gauri Bhandari <bhandarigauri923@gmail.com>
Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* docs: update npm migration instructions

Revised the documentation to include instructions for using npm instead of yarn. This change reflects the migration from using yarn to npm for building, testing, and deploying the docs website.

Closes #2094

Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* ci: update lint.yml to ensure proper commit message formatting

This commit updates the lint.yml file to ensure that commit messages follow the required format.

Closes #2094

Signed-off-by: Gauri Bhandari <bhandarigauri923@gmail.com>
Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* docs: update npm migration instructions

Closes #2094

Signed-off-by: Gauri Bhandari <bhandarigauri923@gmail.com>
Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

* docs: update installation instructions for npm migration

Revised the documentation to reflect the migration from Yarn to npm for building, testing, and deploying the docs website.

Closes #2094

Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>

---------

Signed-off-by: GauriBhandari <bhandarigauri923@gmail.com>
Co-authored-by: Animesh Pathak <kurosakiichigo.songoku@gmail.com>

---------

Signed-off-by: ishaanj18 <ishaan454@gmail.com>
Signed-off-by: Animesh Pathak <kurosakiichigo.songoku@gmail.com>
Signed-off-by: Gauri Bhandari <bhandarigauri923@gmail.com>
Co-authored-by: Animesh Pathak <kurosakiichigo.songoku@gmail.com>
Co-authored-by: Gauri Bhandari <123401864+GauriBhandari@users.noreply.github.com>
Co-authored-by: Animesh Pathak <kurosakiichigo.songoku@gmail.com>
  • Loading branch information
3 people authored and actions-user committed Aug 19, 2024
1 parent fbf713b commit 5a7f55c
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ npm start

or

```shell
npm start
```

or

```shell
yarn start
```
Expand Down
93 changes: 93 additions & 0 deletions versioned_docs/version-2.0.0/quickstart/samples-go-sse-svelte.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
id: samples-sse
title: Sample Real-Time App (Svelte)
sidebar_label: SSE + Svelte + MongoDB
description: The following sample app tests Keploy integration capabilities with realtime subscriptions such as SSE
tags:
- go
- quickstart
- samples
- examples
- tutorial
- svelte
- SSE
keyword:
- Svelte
- Server-Sent Events
- MongoDB Mock
- API Test generator
- Auto Testcase generation
---

## Introduction

🪄 Dive into the world of realtime subscriptions and see how seamlessly Keploy integrates with [SSE](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events) and [MongoDB](https://www.mongodb.com/). Buckle up, it's gonna be a fun ride! 🎢

import InstallationGuide from '../concepts/installation.md'

<InstallationGuide/>

## Installation 📥

Ways you can run this sample application.

- [Using Docker container for MongoDB and running application locally](#installation-setup)

## Installation Setup

#### Server

```bash
git clone https://github.com/keploy/samples-go.git && cd samples-go/sse-svelte
go mod download
```

### Start MongoDB Instance

Using the docker-compose file we will start our mongodb instance:-

```bash
# Start Postgres
docker-compose up mongo
```

### Build Application Binary

Now, we will create the binary of our application:-

```bash
go build -cover
```

Once we have our applicaiton binary ready, we will start the application with keploy to start capturing the testcases.

## Capture the test cases

```bash
sudo -E keploy record "./sse-mongo"
```

### Start the UI

We will capture our test from the UI written in Svelte.js

```bash
cd svelte-app && npm install && npm run dev
```

Now let's click on `GetTime` button to trigger the event. We would notice that keploy will capture those calls : -
![Testcases](https://github.com/keploy/samples-go/raw/main/sse-svelte/img/testcase.png?raw=true)

## Run the Testcases

Now let's run the test mode :-

```shell
keploy test -c "./sse-mongo" --delay 10 --goCoverage
```

Output should look like : -

![Testrun](https://github.com/keploy/samples-go/raw/main/sse-svelte/img/testrun.png?raw=true)

So no need to setup fake database/apis like Postgres or write mocks for them. Keploy automatically mocks them and, **The application thinks it's talking to MongoDb 😄**. And with just few clicks we were able to get 42% code coverage of our go backend application.
1 change: 1 addition & 0 deletions versioned_sidebars/version-2.0.0-sidebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"quickstart/samples-redis",
"quickstart/samples-mux",
"quickstart/samples-mysql",
"quickstart/samples-sse",
"quickstart/samples-fasthttp"
]
},
Expand Down

0 comments on commit 5a7f55c

Please sign in to comment.