is-in-browser/src/test.ts
raw| 1 | import isInBrowser, { isBrowser, isJsDom, isNode } from "."; |
| 2 | |
| 3 | test("isInBrowser", () => { |
| 4 | // jest runs jsdom, so true |
| 5 | expect(isBrowser).toBe(true); |
| 6 | expect(isInBrowser).toBe(true); |
| 7 | |
| 8 | // jest runs jsdom |
| 9 | expect(isJsDom).toBe(true); |
| 10 | |
| 11 | expect(isBrowser && !isJsDom).toBe(false); |
| 12 | |
| 13 | // jest runs on Node, so true |
| 14 | expect(isNode).toBe(true); |
| 15 | |
| 16 | // jest runs JSDOm, so true |
| 17 | }); |