Skip to content

Commit

Permalink
add a test for readme example
Browse files Browse the repository at this point in the history
* which currently fails => need to update code..
  • Loading branch information
Aprillion committed Dec 6, 2020
1 parent 23c917b commit 128a4ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
};
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,8 @@
"rollup-plugin-typescript2": "^0.29.0",
"ts-jest": "^26.4.3",
"typescript": "^4.0.5"
},
"scripts": {
"test": "jest"
}
}
8 changes: 8 additions & 0 deletions src/LiveStorage.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { LiveStorage } from "./LiveStorage";

test("REAME example does not throw", () => {
// TODO: BroadcastChannel is not available in Node 14 nor `jsdom` environment
const posts = new LiveStorage("posts", []);

posts.update((prevPosts) => prevPosts.concat({ title: "Brave new world" });
});

0 comments on commit 128a4ac

Please sign in to comment.