-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f41fa6b
commit af9d7cb
Showing
8 changed files
with
4,706 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
roots: ["<rootDir>/src"], | ||
testMatch: ["**/__tests__/**/*.+(ts|tsx|js)", "**/?(*.)+(spec|test).+(ts|tsx|js)"], | ||
transform: { | ||
"^.+\\.(ts|tsx)$": "ts-jest", | ||
}, | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import livesession from "./index"; | ||
import api from "./api"; | ||
|
||
test("Call any other function before init", () => { | ||
expect(() => { | ||
livesession.setOptions({ rootHostname: "test" }); | ||
throw new Error(); | ||
}).toThrow(); | ||
}); | ||
|
||
it("should call init method", () => { | ||
const initScript = jest.fn((trackID: string, options?: object) => { | ||
livesession.init("test"); | ||
return api.init(trackID, options); | ||
}); | ||
initScript("jkjfdsfds"); | ||
expect(initScript).toBeCalledTimes(1); | ||
}); | ||
|
||
test("Check if script is added", () => { | ||
const initScript = jest.fn(() => window.__ls && console.warn("LiveSession already inited (skipping init() call)")); | ||
initScript(); | ||
expect(initScript).toHaveReturned(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"target": "es2015", | ||
"module": "commonjs", | ||
"outDir": "./dist" | ||
"outDir": "dist" | ||
}, | ||
"include": ["./src/**/*", "index.ts", "src/index.d.ts"] | ||
"include": ["./src/**/*", "src/index.ts", "src/index.d.ts"], | ||
"exclude": ["node_modules", "**/*.spec.ts"] | ||
} |