Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions feature-utils/poly-import/utils/zipfile-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { jsonStringifyWithUtfEscape } from "./json-encoding";
//The minimum size of a .ZIP file is 22 bytes
export const MINIMUM_FILE_SIZE = 22;
export class ZipFileEntryMock {
constructor(zipFile, id, path, content) {
this.zipFile = zipFile;
constructor(id, path, content) {
this._id = id;
this._path = path;
this.content = content;
Expand All @@ -18,12 +17,11 @@ export class ZipFileEntryMock {
}

async stat() {
const entryContent = this.zipFile.entries[this._id];
return {
getId: () => this._id,
getTime: () => "",
getName: () => this._id.substr(this.zipFile.id.length),
getSize: () => entryContent.length,
getName: () => this._path,
getSize: () => this.content.length,
isFile: () => true,
isDirectory: () => false,
};
Expand Down Expand Up @@ -70,12 +68,7 @@ export class ZipFileMock {

addNamedEntry(fileName, stringContent) {
const entryId = this.id + "/" + fileName;
const entry = new ZipFileEntryMock(
this,
entryId,
fileName,
stringContent
);
const entry = new ZipFileEntryMock(entryId, fileName, stringContent);
this._entriesPathHash.set(fileName, entry);
}

Expand Down