This repository has been archived by the owner on Apr 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kinda raising this coverage thing that people get focused on
- Loading branch information
Showing
7 changed files
with
48 additions
and
2 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
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 { createClient, OfflineClient } from "../src"; | ||
import { expect, should } from "chai"; | ||
import { mock } from "fetch-mock"; | ||
import { storage } from "./mock/Storage"; | ||
import { networkStatus } from "./mock/NetworkState"; | ||
|
||
const url = "http://test"; | ||
|
||
describe("Top level api tests", () => { | ||
before(() => { | ||
mock(url, 200); | ||
}); | ||
it("check old api", async () => { | ||
const client = await createClient({ | ||
httpUrl: url, storage, networkStatus}); | ||
should().exist(client.offlineStore); | ||
}); | ||
|
||
it("check new api", async () => { | ||
const client = new OfflineClient({ httpUrl: url, storage, networkStatus }); | ||
const initClient = await client.init(); | ||
should().exist(initClient.offlineStore); | ||
}); | ||
}); |
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,8 @@ | ||
export const networkStatus = { | ||
isOffline() { | ||
return Promise.resolve(false); | ||
}, | ||
onStatusChangeListener() { | ||
return; | ||
} | ||
}; |
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,12 @@ | ||
export const storage = { | ||
getItem: () => { | ||
console.info("Called"); | ||
return "{}"; | ||
}, | ||
setItem: () => { | ||
console.info("Called"); | ||
}, | ||
removeItem: () => { | ||
console.info("Called"); | ||
} | ||
}; |
File renamed without changes.
File renamed without changes.