Merge branch 'master' of github.com:backstage/backstage into blam/isomorphic-git

* 'master' of github.com:backstage/backstage: (23 commits)
  cli: fix windows tests
  Introduce slight bias towards positive trend in cost insights mock data
  core-api: rename BackstageRoutes to FlatRoutes
  Update plugins/catalog/src/hooks/useEntity.ts
  Fix parameter name in docstring for duration#inclusiveStartDateOf
  Adjust test
  Add changeset
  fix: token expiration in s, not ms
  Create loud-days-breathe.md
  Create polite-glasses-occur.md
  dev-utils: add a small label with the entity name to EntityGridItems
  dev-utils: add EntityGridItem for easily displaying various entity cards
  dev-utils: use dev index module as root for hot reloading
  dev-utils: add .registerPage for use with extensions
  catalog: rename EntityProvider to EntityLoaderProvider, and add new EntityProvider
  reduce close timeout to 100 ms
  changeset: add changeset for core-api RouteRef deprecations
  core-api: use typescript workaround for using private constructor instead of a runtime one
  core-api: deprecate RouteRef path and remove deprecated createSubRoute
  delay window close by 200 ms
  ...
This commit is contained in:
blam
2020-12-28 17:39:15 +01:00
30 changed files with 303 additions and 89 deletions
@@ -14,6 +14,8 @@
* limitations under the License.
*/
import mockFs from 'mock-fs';
import * as os from 'os';
import * as path from 'path';
import { getFileTreeRecursively, getHeadersForFileExtension } from './helpers';
describe('getHeadersForFileExtension', () => {
@@ -39,9 +41,11 @@ describe('getHeadersForFileExtension', () => {
});
describe('getFileTreeRecursively', () => {
const root = os.platform() === 'win32' ? 'C:\\rootDir' : '/rootDir';
beforeEach(() => {
mockFs({
'/rootDir': {
[root]: {
file1: '',
subDirA: {
file2: '',
@@ -57,9 +61,9 @@ describe('getFileTreeRecursively', () => {
});
it('returns complete file tree of a path', async () => {
const fileList = await getFileTreeRecursively('/rootDir');
const fileList = await getFileTreeRecursively(root);
expect(fileList.length).toBe(2);
expect(fileList).toContain('/rootDir/file1');
expect(fileList).toContain('/rootDir/subDirA/file2');
expect(fileList).toContain(path.resolve(root, 'file1'));
expect(fileList).toContain(path.resolve(root, 'subDirA/file2'));
});
});