-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes #805 The value of copyFrom.fetcher is not used in the LoadingOp…
…tions constructor in typescript
- Loading branch information
Showing
2 changed files
with
30 additions
and
1 deletion.
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,29 @@ | ||
import { assert } from 'chai' | ||
import { Fetcher, LoadingOptions } from '../util/Internal' | ||
|
||
class TestFetcher implements Fetcher { | ||
checkExists(url: string): boolean { | ||
return true | ||
} | ||
async fetchText(url: string, contentTypes?: string[] | undefined): Promise<string> { | ||
return "TestFetcher" | ||
} | ||
urljoin(baseUrl: string, url: string): string { | ||
return `${baseUrl}/${url}` | ||
} | ||
} | ||
|
||
describe('Test LoadingOptions', () => { | ||
describe('copyFrom', () => { | ||
const original = new LoadingOptions({fetcher: new TestFetcher()}) | ||
it('should have the same Fetcher as the original', async () => { | ||
const copy = new LoadingOptions({copyFrom:original}) | ||
assert.equal(copy.fetcher,original.fetcher) | ||
}) | ||
it('fetcher should take precedence over copyFrom', async () => { | ||
const fetcher = new TestFetcher() | ||
const copy = new LoadingOptions({fetcher,copyFrom:original}) | ||
assert.equal(copy.fetcher,fetcher) | ||
}) | ||
}) | ||
}) |
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