Files
remark42/frontend/app/__mocks__/headers.ts
T
Pavel MineevandUmputun 5825a55b69 Update frontend
* change root dit and change way to import modules
* update deps to latest versions
* use latest tools for building bundles
* rewrite webpack config
* use nomodule technique for loading modern bundle
* inject polyfills by babel usebuiltins
* update eslint rules
* rename all style files to CSS
* use postcss preset env for building styles
* proper typescript typing
* put all html files to templates folder
* etc
2021-01-12 13:39:26 -06:00

25 lines
649 B
TypeScript

global.Headers = class HeadersMock extends Headers implements Headers {
private headers = new Map();
append(key: string, value: string) {
this.headers.set(key, value);
}
set(key: string, value: string) {
this.headers.set(key, value);
}
has(key: string) {
return this.headers.has(key);
}
get(key: string) {
return this.headers.get(key) || null;
}
delete(key: string) {
this.headers.delete(key);
}
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any) {
this.headers.forEach((value, key) => {
callbackfn.call(thisArg || this, value, key, this);
});
}
};