fix migration test

pull/5370/head
bunsenstraat 3 years ago
parent 6cf904457b
commit b38d1248c4
  1. 2
      apps/remix-ide-e2e/src/tests/migrateFileSystem.test.ts
  2. 4
      apps/remix-ide/src/app.js
  3. 9
      apps/remix-ide/src/app/files/fileManager.js
  4. 1
      apps/remix-ide/src/app/files/fileProvider.js
  5. 2
      apps/remix-ide/src/lib/gist-handler.js

@ -9,7 +9,7 @@ module.exports = {
'Should have README file with TEST README as content': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.click('*[data-id="verticalIconsFileExplorerIcons"]')
.openFile('README.txt')
.openFile('TEST_README.txt')
.getEditorValue((content) => {
browser.assert.equal(content, 'TEST README')
})

@ -20,7 +20,7 @@ import { MainPanel } from './app/components/main-panel'
import { OffsetToLineColumnConverter, CompilerMetadata, CompilerArtefacts, FetchAndCompile, CompilerImports } from '@remix-project/core-plugin'
import migrateFileSystem from './migrateFileSystem'
const isElectron = require('is-electron')
const csjs = require('csjs-inject')
@ -158,7 +158,7 @@ class App {
registry.put({ api: self._components.filesProviders, name: 'fileproviders' })
migrateFileSystem(self._components.filesProviders.browser)
}
init () {

@ -744,10 +744,10 @@ class FileManager extends Plugin {
if (!fileProvider) fileProvider = 'browser'
if (override === undefined) override = false
async.each(Object.keys(filesSet), (file, callback) => {
async.each(Object.keys(filesSet), async (file, callback) => {
if (override) {
try {
self._deps.filesProviders[fileProvider].set(file, filesSet[file].content)
await self._deps.filesProviders[fileProvider].set(file, filesSet[file].content)
} catch (e) {
return callback(e.message || e)
}
@ -756,14 +756,15 @@ class FileManager extends Plugin {
}
helper.createNonClashingName(file, self._deps.filesProviders[fileProvider],
(error, name) => {
async (error, name) => {
if (error) {
modalDialogCustom.alert('Unexpected error loading the file ' + error)
} else if (helper.checkSpecialChars(name)) {
modalDialogCustom.alert('Special characters are not allowed')
} else {
try {
self._deps.filesProviders[fileProvider].set(name, filesSet[file].content)
console.log('set ', fileProvider, name, filesSet[file].content)
await self._deps.filesProviders[fileProvider].set(name, filesSet[file].content)
} catch (e) {
return callback(e.message || e)
}

@ -293,7 +293,6 @@ class FileProvider {
return ret
} catch (error) {
if (cb) cb(error, null)
throw new Error(error)
}
}

@ -58,8 +58,10 @@ function GistHandler (_window) {
obj['/' + 'gist-' + gistId + '/' + path] = data.files[element]
})
console.log('loading gist', obj)
fileManager.setBatchFiles(obj, 'workspace', true, (errorLoadingFile) => {
if (!errorLoadingFile) {
console.log('gist loaded')
const provider = fileManager.getProvider('workspace')
provider.lastLoadedGistId = gistId
} else {

Loading…
Cancel
Save