mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
chore: cloudcmd
This commit is contained in:
parent
6e778a35ba
commit
4b84d20bb0
17 changed files with 121 additions and 132 deletions
|
|
@ -22,12 +22,9 @@ test('cloudcmd: client: view: types: detectType', async (t) => {
|
|||
headers: [],
|
||||
});
|
||||
|
||||
const originalFetch = global.fetch;
|
||||
|
||||
global.fetch = fetch;
|
||||
globalThis.fetch = fetch;
|
||||
await _detectType('/hello');
|
||||
|
||||
global.fetch = originalFetch;
|
||||
const expected = ['/hello', {
|
||||
method: 'HEAD',
|
||||
}];
|
||||
|
|
@ -37,17 +34,13 @@ test('cloudcmd: client: view: types: detectType', async (t) => {
|
|||
});
|
||||
|
||||
test('cloudcmd: client: view: types: detectType: found', async (t) => {
|
||||
const originalFetch = global.fetch;
|
||||
|
||||
global.fetch = stub().returns({
|
||||
globalThis.fetch = stub().returns({
|
||||
headers: [
|
||||
['content-type', 'image/png'],
|
||||
],
|
||||
});
|
||||
const result = await _detectType('/hello');
|
||||
|
||||
global.fetch = originalFetch;
|
||||
|
||||
t.equal(result, '.png');
|
||||
t.end();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue