Yarn workspaces
Summary: 1) moved "sonar/desktop/src" to "sonar/desktop/app/src", so "app" is now a separate package containing the core Flipper app code 2) Configured yarn workspaces with the root in "sonar/desktop": app, static, pkg, doctor, headless-tests. Plugins are not included for now, I plan to do this later. Reviewed By: jknoxville Differential Revision: D20535782 fbshipit-source-id: 600b2301960f37c7d72166e0d04eba462bec9fc1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
676d7bbd24
commit
863f89351e
40
desktop/app/src/utils/__tests__/jsonFileStorage.node.js
Normal file
40
desktop/app/src/utils/__tests__/jsonFileStorage.node.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import JsonFileStorage from '../jsonFileReduxPersistStorage.tsx';
|
||||
import fs from 'fs';
|
||||
|
||||
const validSerializedData = fs
|
||||
.readFileSync('app/src/utils/__tests__/data/settings-v1-valid.json')
|
||||
.toString()
|
||||
.replace(/\r\n/g, '\n')
|
||||
.trim();
|
||||
|
||||
const validDeserializedData =
|
||||
'{"androidHome":"\\"/opt/android_sdk\\"","something":"{\\"else\\":4}","_persist":"{\\"version\\":-1,\\"rehydrated\\":true}"}';
|
||||
|
||||
const storage = new JsonFileStorage(
|
||||
'app/src/utils/__tests__/data/settings-v1-valid.json',
|
||||
);
|
||||
|
||||
test('A valid settings file gets parsed correctly', () => {
|
||||
return storage
|
||||
.getItem('anykey')
|
||||
.then(result => expect(result).toEqual(validDeserializedData));
|
||||
});
|
||||
|
||||
test('deserialize works as expected', () => {
|
||||
const deserialized = storage.deserializeValue(validSerializedData);
|
||||
expect(deserialized).toEqual(validDeserializedData);
|
||||
});
|
||||
|
||||
test('serialize works as expected', () => {
|
||||
const serialized = storage.serializeValue(validDeserializedData);
|
||||
expect(serialized).toEqual(validSerializedData);
|
||||
});
|
||||
Reference in New Issue
Block a user