-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix tests for 'wrangler pages publish'
- Loading branch information
1 parent
eaf348d
commit 72bf28d
Showing
4 changed files
with
21 additions
and
42 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 |
---|---|---|
@@ -1,31 +1,36 @@ | ||
import { getConfigCache, saveToConfigCache } from "../config-cache"; | ||
import { runInTempDir } from "./helpers/run-in-tmp"; | ||
|
||
interface PagesConfigCache { | ||
account_id: string; | ||
pages_project_name: string; | ||
} | ||
|
||
describe("config cache", () => { | ||
runInTempDir(); | ||
|
||
const pagesConfigCacheFilename = "pages-config-cache.json"; | ||
|
||
it("should return an empty config if no file exists", () => { | ||
expect(getConfigCache(pagesConfigCacheFilename)).toMatchInlineSnapshot( | ||
`Object {}` | ||
); | ||
expect( | ||
getConfigCache<PagesConfigCache>(pagesConfigCacheFilename) | ||
).toMatchInlineSnapshot(`Object {}`); | ||
}); | ||
|
||
it("should read and write values without overriding old ones", () => { | ||
saveToConfigCache(pagesConfigCacheFilename, { | ||
saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, { | ||
account_id: "some-account-id", | ||
pages_project_name: "foo", | ||
}); | ||
expect(getConfigCache(pagesConfigCacheFilename).account_id).toEqual( | ||
"some-account-id" | ||
); | ||
expect( | ||
getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id | ||
).toEqual("some-account-id"); | ||
|
||
saveToConfigCache(pagesConfigCacheFilename, { | ||
saveToConfigCache<PagesConfigCache>(pagesConfigCacheFilename, { | ||
pages_project_name: "bar", | ||
}); | ||
expect(getConfigCache(pagesConfigCacheFilename).account_id).toEqual( | ||
"some-account-id" | ||
); | ||
expect( | ||
getConfigCache<PagesConfigCache>(pagesConfigCacheFilename).account_id | ||
).toEqual("some-account-id"); | ||
}); | ||
}); |
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