plugin-chart.test.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. import { dirname, join } from 'path';
  20. import helpers, { result } from 'yeoman-test';
  21. import { copySync } from 'fs-extra/esm';
  22. import { fileURLToPath } from 'url';
  23. import pluginChartModule from '../generators/plugin-chart';
  24. test('generator-superset:plugin-chart:creates files', async () => {
  25. await helpers
  26. .run(pluginChartModule)
  27. .onTargetDirectory(dir => {
  28. // `dir` is the path to the new temporary directory
  29. const generatorDirname = dirname(fileURLToPath(import.meta.url));
  30. copySync(
  31. join(generatorDirname, '../generators/plugin-chart/templates'),
  32. join(dir, 'unknown/templates'),
  33. );
  34. })
  35. .withPrompts({
  36. packageName: 'cold-map',
  37. description: 'Cold Map',
  38. componentType: 'function',
  39. chartType: 'regular',
  40. })
  41. .withOptions({ skipInstall: true });
  42. result.assertFile([
  43. '.gitignore',
  44. 'babel.config.js',
  45. 'jest.config.js',
  46. 'package.json',
  47. 'README.md',
  48. 'src/plugin/buildQuery.ts',
  49. 'src/plugin/controlPanel.ts',
  50. 'src/plugin/index.ts',
  51. 'src/plugin/transformProps.ts',
  52. 'src/ColdMap.tsx',
  53. 'src/index.ts',
  54. 'test/index.test.ts',
  55. 'test/__mocks__/mockExportString.js',
  56. 'test/plugin/buildQuery.test.ts',
  57. 'test/plugin/transformProps.test.ts',
  58. 'types/external.d.ts',
  59. 'src/images/thumbnail.png',
  60. ]);
  61. });