Skip to content

Commit

Permalink
Add back accidentally deleted doctests file (#2821)
Browse files Browse the repository at this point in the history
* Add back accidentally deleted doctest file

* Update string-set-get-example.js
  • Loading branch information
dwdougherty authored Sep 26, 2024
1 parent 06e91d0 commit 9f810c2
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions doctests/string-set-get-example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// EXAMPLE: set_and_get
// REMOVE_START
import assert from "node:assert";
// REMOVE_END

// HIDE_START
import { createClient } from 'redis';

const client = createClient();

client.on('error', err => console.log('Redis Client Error', err));

await client.connect().catch(console.error);

// HIDE_END
await client.set('bike:1', 'Process 134');
const value = await client.get('bike:1');
console.log(value);
// returns 'Process 134'
//REMOVE_START
assert.equal(value, 'Process 134');
await client.del('bike:1');
//REMOVE_END

// HIDE_START
await client.quit();
// HIDE_END

0 comments on commit 9f810c2

Please sign in to comment.