Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored utilities #39

Merged
merged 10 commits into from
May 17, 2023
Prev Previous commit
Next Next commit
refactor: Removed utilities for tests
ijlee2 committed May 17, 2023
commit 6ccf3de629cdf0b9726adfc4dac881d7a89b8df9
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertFixtureToJson } from '../../helpers/testing.js';
import { convertFixtureToJson } from '@codemod-utils/tests';

const inputProject = convertFixtureToJson('ember-app-flat/input');
const outputProject = convertFixtureToJson('ember-app-flat/output');
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { convertFixtureToJson } from '../../helpers/testing.js';
import { convertFixtureToJson } from '@codemod-utils/tests';

const inputProject = convertFixtureToJson('ember-app-nested/input');
const outputProject = convertFixtureToJson('ember-app-nested/output');
9 changes: 0 additions & 9 deletions packages/type-css-modules/tests/helpers/testing.js

This file was deleted.

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions packages/type-css-modules/tests/helpers/testing/load-fixture.js

This file was deleted.

3 changes: 2 additions & 1 deletion packages/type-css-modules/tests/index/ember-app-flat.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { assertFixture, loadFixture, test } from '@codemod-utils/tests';

import { typeCssModules } from '../../src/index.js';
import {
inputProject,
outputProject,
} from '../fixtures/ember-app-flat/index.js';
import { codemodOptions } from '../helpers/shared-test-setups/ember-app-flat.js';
import { assertFixture, loadFixture, test } from '../helpers/testing.js';

test('index > ember-app-flat', function () {
loadFixture(inputProject, codemodOptions);
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { assertFixture, loadFixture, test } from '@codemod-utils/tests';

import { typeCssModules } from '../../src/index.js';
import {
inputProject,
outputProject,
} from '../fixtures/ember-app-nested/index.js';
import { codemodOptions } from '../helpers/shared-test-setups/ember-app-nested.js';
import { assertFixture, loadFixture, test } from '../helpers/testing.js';

test('index > ember-app-nested', function () {
loadFixture(inputProject, codemodOptions);
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { cleanDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-flat.js';
import {
assertFixture,
convertFixtureToJson,
loadFixture,
test,
} from '../../helpers/testing.js';
} from '@codemod-utils/tests';

import { cleanDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-flat.js';

test('steps | clean-declaration-files > ember-app-flat', function () {
const inputProject = convertFixtureToJson(
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { cleanDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-nested.js';
import {
assertFixture,
convertFixtureToJson,
loadFixture,
test,
} from '../../helpers/testing.js';
} from '@codemod-utils/tests';

import { cleanDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-nested.js';

test('steps | clean-declaration-files > ember-app-nested', function () {
const inputProject = convertFixtureToJson(
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { createDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-flat.js';
import {
assertFixture,
convertFixtureToJson,
loadFixture,
test,
} from '../../helpers/testing.js';
} from '@codemod-utils/tests';

import { createDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-flat.js';

test('steps | create-declaration-files > ember-app-flat', function () {
const inputProject = convertFixtureToJson(
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { createDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-nested.js';
import {
assertFixture,
convertFixtureToJson,
loadFixture,
test,
} from '../../helpers/testing.js';
} from '@codemod-utils/tests';

import { createDeclarationFiles } from '../../../src/steps/index.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-nested.js';

test('steps | create-declaration-files > ember-app-nested', function () {
const inputProject = convertFixtureToJson(
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert, test } from '@codemod-utils/tests';

import { createOptions } from '../../../src/steps/index.js';
import { codemodOptions } from '../../helpers/shared-test-setups/ember-app-flat.js';
import { assert, test } from '../../helpers/testing.js';

test('steps | create-options > ember-app-flat', function () {
assert.deepStrictEqual(createOptions(codemodOptions), {
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert, test } from '@codemod-utils/tests';

import { createOptions } from '../../../src/steps/index.js';
import { codemodOptions } from '../../helpers/shared-test-setups/ember-app-nested.js';
import { assert, test } from '../../helpers/testing.js';

test('steps | create-options > ember-app-nested', function () {
assert.deepStrictEqual(createOptions(codemodOptions), {
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assert, test } from '@codemod-utils/tests';

import { ASTCSS as AST } from '../../../src/utils/abstract-syntax-tree.js';
import { assert, test } from '../../helpers/testing.js';

test('utils | abstract-syntax-tree | css > file is empty', function () {
const oldFile = '';
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { assert, loadFixture, test } from '@codemod-utils/tests';

import { getClassNames } from '../../../src/utils/css.js';
import {
codemodOptions,
options,
} from '../../helpers/shared-test-setups/ember-app-flat.js';
import { assert, loadFixture, test } from '../../helpers/testing.js';

test('utils | css | get-class-names > base case (1)', function () {
const cssFile = [
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert, test } from '@codemod-utils/tests';

import { getCssDeclarationFilePaths } from '../../../src/utils/css.js';
import { options } from '../../helpers/shared-test-setups/ember-app-flat.js';
import { assert, test } from '../../helpers/testing.js';

test('utils | css | get-css-declaration-file-paths', function () {
assert.deepStrictEqual(getCssDeclarationFilePaths(options), [
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { assert, test } from '@codemod-utils/tests';

import { getCssFilePaths } from '../../../src/utils/css.js';
import { options } from '../../helpers/shared-test-setups/ember-app-flat.js';
import { assert, test } from '../../helpers/testing.js';

test('utils | css | get-css-file-paths', function () {
assert.deepStrictEqual(getCssFilePaths(options), ['app/**/*.css']);
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { assert, test } from '@codemod-utils/tests';

import { getDeclarationFile } from '../../../src/utils/css.js';
import { assert, test } from '../../helpers/testing.js';

test('utils | css | get-declaration-file > base case', function () {
const classNames = ['copyright', 'has-error', 'link', 'list'];