-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to provide a checksum for global cache (#42)
- Loading branch information
Showing
14 changed files
with
11,786 additions
and
11,251 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 |
---|---|---|
|
@@ -6,6 +6,13 @@ | |
"build": "deno task wasmbuild", | ||
"wasmbuild": "deno run -A https://deno.land/x/[email protected]/main.ts --sync --features wasm" | ||
}, | ||
"lint": { | ||
"rules": { | ||
"include": [ | ||
"no-console" | ||
] | ||
} | ||
}, | ||
"exclude": [ | ||
"target" | ||
] | ||
|
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,7 +1,7 @@ | ||
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. | ||
|
||
import { DenoDir } from "./deno_dir.ts"; | ||
import { createGraph } from "./deps_test.ts"; | ||
import { assertRejects, createGraph } from "./deps_test.ts"; | ||
import { FileFetcher } from "./file_fetcher.ts"; | ||
|
||
Deno.test({ | ||
|
@@ -14,6 +14,64 @@ Deno.test({ | |
return fileFetcher.fetch(new URL(specifier)); | ||
}, | ||
}); | ||
console.log(graph.toString()); | ||
// deno-lint-ignore no-console | ||
console.log(graph); | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: "FileFetcher - bad checksum no cache", | ||
async fn() { | ||
const denoDir = new DenoDir(); | ||
const fileFetcher = new FileFetcher(denoDir.createHttpCache()); | ||
{ | ||
// should error | ||
await assertRejects(async () => { | ||
await fileFetcher.fetch( | ||
new URL("https://deno.land/x/[email protected]/mod.ts"), | ||
{ | ||
checksum: "bad", | ||
}, | ||
); | ||
}); | ||
// ok for good checksum | ||
await fileFetcher.fetch( | ||
new URL("https://deno.land/x/[email protected]/mod.ts"), | ||
{ | ||
checksum: | ||
"7a1b5169ef702e96dd994168879dbcbd8af4f639578b6300cbe1c6995d7f3f32", | ||
}, | ||
); | ||
} | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: "FileFetcher - bad checksum reload", | ||
async fn() { | ||
const denoDir = new DenoDir(); | ||
const fileFetcher = new FileFetcher(denoDir.createHttpCache()); | ||
await assertRejects(async () => { | ||
await fileFetcher.fetch( | ||
new URL("https://deno.land/x/[email protected]/mod.ts"), | ||
{ | ||
cacheSetting: "reload", | ||
checksum: "bad", | ||
}, | ||
); | ||
}); | ||
}, | ||
}); | ||
|
||
Deno.test({ | ||
name: "FileFetcher - good checksum reload", | ||
async fn() { | ||
const denoDir = new DenoDir(); | ||
const fileFetcher = new FileFetcher(denoDir.createHttpCache()); | ||
await fileFetcher.fetch(new URL("https://deno.land/x/[email protected]/mod.ts"), { | ||
cacheSetting: "reload", | ||
checksum: | ||
"7a1b5169ef702e96dd994168879dbcbd8af4f639578b6300cbe1c6995d7f3f32", | ||
}); | ||
}, | ||
}); |
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
Oops, something went wrong.