Skip to content

Commit

Permalink
Move utils to utils dir
Browse files Browse the repository at this point in the history
  • Loading branch information
ncalteen committed Sep 22, 2023
1 parent 0535024 commit 9b3d43a
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import fs from 'fs'
import YAML from 'yaml'
import * as core from '@actions/core'
import * as main from '../src/main'
import * as parse from '../src/parse'
import * as parse from '../src/utils/parse'

// Get the expected data (before mocking fs)
const parsedIssue: string = fs.readFileSync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Unit tests for the action's format.ts file.
*/

import { formatKey } from '../src/format'
import { formatKey } from '../../src/utils/format'

describe('formatKey', () => {
it('removes non-alphanumeric characters', async () => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/parse.test.ts → __tests__/utils/parse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Unit tests for the parser, src/parse.ts
*/

import * as parse from '../src/parse'
import { IssueFormTemplate } from '../src/interfaces'
import * as parse from '../../src/utils/parse'
import { IssueFormTemplate } from '../../src/interfaces'

describe('parseTemplate', () => {
it('skips markdown fields', async () => {
Expand Down
66 changes: 33 additions & 33 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as core from '@actions/core'
import fs from 'fs'
import YAML from 'yaml'
import { parseTemplate } from './parse'
import { parseTemplate } from './utils/parse'
import { FormattedField, ParsedBody } from './interfaces'
import { validate } from './validate'

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/parse.ts → src/utils/parse.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IssueFormTemplate, FormattedField } from './interfaces'
import { IssueFormTemplate, FormattedField } from '../interfaces'
import { formatKey } from './format'

/**
Expand Down
4 changes: 2 additions & 2 deletions src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export async function validate(
const errors: string[] = []

for (const [key, props] of Object.entries(template)) {
// TODO: Custom validators

// Type-specific validations
if (props.type === 'input') {
validateInput(key, props, issue, errors)
Expand All @@ -29,6 +27,8 @@ export async function validate(
} else if (props.type === 'checkboxes') {
validateCheckboxes(key, props, issue, errors)
}

// TODO: Custom validators
}

return errors
Expand Down

0 comments on commit 9b3d43a

Please sign in to comment.