Skip to content

Commit

Permalink
Merge pull request #33 from svg2fontTeam/trunk
Browse files Browse the repository at this point in the history
release/0.0.1 action test
  • Loading branch information
yoon-jisung authored May 11, 2024
2 parents 5a06518 + 81b91a5 commit b4b8b9d
Show file tree
Hide file tree
Showing 29 changed files with 1,293 additions and 97 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release Tag
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 버전 정보 추출
run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
id: extract_version_name
- name: Release 생성
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_version_name.outputs.version }}
release_name: ${{ steps.extract_version_name.outputs.version }}
80 changes: 80 additions & 0 deletions docs/tests/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
## 목적

피그마에서 사용자가 플러그인을 활용해 svg파일을 iconfont파일로 변환시켜서 코드에서 사용할 수 있어야함.

## 대상

### `inputText`

- **테스트 수준 및 유형**
- 유닛 테스트 / 기능 테스트
- **시나리오**
1. 모든 inputText에 '<', '>', ':', /(슬래시), \(역슬래시), |(파이프), ?(물음표), \*(별표asterisk), 공백( )
, '#'(샤프, 해시), %(퍼센트), &(앰퍼샌드), '(단일 인용부호), "(이중 인용부호), ;(세미콜론), --(SQL 주석), '\n', '\t'
, '\r' 를 입력하면 "Special characters such as (<, >, :, /, \, |, ?, \*, ' ', #, %, &, ', ", ;, -, \n, \t, \r) are not allowed."
이라는 경고 알림창이 나타남.
2. Font Name inputText에 입력할 수 있는 길이는 255를 넘을 수 없음.
3. prefix와 suffix inputText에 입력할 수 있는 길이는 50을 넘을 수 없음.
4. Version inputText에 숫자와 '.'을 제외한 값을 입력한 경우 inputText의 border color가 red로 변하고 'Only numbers and '.' are
allowed as input'이라는 경고 알림창이 나타남.
- **환경 및 도구**
- Jest
- **책임**
- 김동욱

### `Button`

- **테스트 수준 및 유형**
- 유닛 테스트 / 기능 테스트
- **시나리오**
1. SVG파일이 아닌 이미지나 오브젝트를 선택 후 버튼을 누르면 'Only SVG files can be converted to font format. Please upload an SVG
file'이라는 경고 알림창이 나타남.
2. 중복된 이름의 SVG파일을 선택 후 버튼을 누르면 'Duplicate file name detected.'이라는 경고 알림창이 나타남.
3. 필수 입력값을 입력하지 않고 버튼을 누르면 입력되지 않은 필수 입력항목에 포커스, bolder color가 red로 표시됨.
- **환경 및 도구**
- Jest
- **책임**
- 김동욱

### `IconDrag`

- **테스트 수준 및 유형**
- 유닛 테스트/기능 테스트
- **시나리오**
- 드레그한 SVG파일들이 제작한 플러그인에 반영이 된다.
- 선택한 SVG 파일 갯수가 생성버튼에 표시된다.
- **환경 및 도구**
- Jest
- **책임**
- 윤승호

### `FontGeneration`

- **테스트 수준 및 유형**
- 유닛 테스트/기능 테스트
- **시나리오**
- 드레그한 SVG 파일 기반으로 ttf으로 변환하고 입력한 폰트이름(fontName)인 파일을 생성한다.
- ttf 파일을 .woff으로 변환하고 입력한 폰트이름(fontName)인 파일을 생성한다.
- ttf 파일을 .otf으로 변환하고 입력한 폰트이름(fontName)인 파일을 생성한다.
- 폰트정보를 담고 있는 CSS 파일을 생성하고 입력한 폰트이름(fontName)인 파일을 생성한다.
- 변환된 폰트 데모 마크업 페이지가 생성된다.
- Vue 옵션이 선택되었다면 Vue 템플릿을 생성한다.
- React 옵션이 선택되었다면 React 템플릿을 생성한다.
- 폴더를 생성하고 생성된 모든 파일들을 폴더로 옮긴다.
- 위에 파일을 모두 압축한 .zip 확장자를 가지고 입력한 폰트이름(fontName)압축파일이 생성된다.
- **환경 및 도구**
- Jest
- **책임**
- 윤승호

### `VersionPage`

- **테스트 수준 및 유형**
- 기능 테스트
- **시나리오**
- 입력한 version 명의 페이지가 생성된다.
- 변환한 svg들이 page안에 복사가 되어 노출된다.
- **환경 및 도구**
- Jest
- **책임**
- 김지나
208 changes: 208 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires

/**
* For a detailed explanation regarding each configuration property, visit:
* https://jestjs.io/docs/configuration
*/

/** @type {import('jest').Config} */

const config = {
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['./jest.setup.js'],
globals: {
jest: {
tsconfig: 'tsconfig.test.json', // 테스트용 설정 파일 지정
},
},
// All imported modules in your tests should be mocked automatically
// automock: false,

// Stop running tests after `n` failures
// bail: 0,

// The directory where Jest should store its cached dependency information
// cacheDirectory: "/private/var/folders/wg/rjz_wrhj29b1bbg3qf8jbd6h0000gn/T/jest_dx",

// Automatically clear mock calls, instances, contexts and results before every test
clearMocks: true,

// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,

// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,

// The directory where Jest should output its coverage files
// coverageDirectory: undefined,

// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],

// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',

// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],

// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,

// A path to a custom dependency extractor
// dependencyExtractor: undefined,

// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,

// The default configuration for fake timers
// fakeTimers: {
// "enableGlobally": false
// },

// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],

// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,

// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,

// A set of global variables that need to be available in all test environments
// globals: {},

// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",

// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],

// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "mjs",
// "cjs",
// "jsx",
// "ts",
// "tsx",
// "json",
// "node"
// ],

// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},

// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],

// Activates notifications for test results
// notify: false,

// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",

// A preset that is used as a base for Jest's configuration
// preset: undefined,

// Run tests from one or more projects
// projects: undefined,

// Use this configuration option to add custom reporters to Jest
// reporters: undefined,

// Automatically reset mock state before every test
// resetMocks: false,

// Reset the module registry before running each individual test
// resetModules: false,

// A path to a custom resolver
// resolver: undefined,

// Automatically restore mock state and implementation before every test
// restoreMocks: false,

// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,

// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],

// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",

// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],

// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],

// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,

// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],

// The test environment that will be used for testing
// testEnvironment: "jest-environment-node",

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},

// Adds a location field to test results
// testLocationInResults: false,

// The glob patterns Jest uses to detect test files
// testMatch: [
// "**/__tests__/**/*.[jt]s?(x)",
// "**/?(*.)+(spec|test).[tj]s?(x)"
// ],

// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],

// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],

// This option allows the use of a custom results processor
// testResultsProcessor: undefined,

// This option allows use of a custom test runner
// testRunner: "jest-circus/runner",

// A map from regular expressions to paths to transformers
// transform: undefined,

// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],

// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,

// Indicates whether each individual test should be reported during the run
// verbose: undefined,

// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],

// Whether to use watchman for file crawling
// watchman: true,
};

module.exports = config;
27 changes: 27 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { TextEncoder, TextDecoder } = require('util');
global.TextEncoder = TextEncoder;
global.TextDecoder = TextDecoder;

// jest.setup.js
global.figma = {
// 필요한 메서드나 속성을 모의로 추가
root: {
children: [],
insertChild: jest.fn(),
},
closePlugin: jest.fn(),
notify: jest.fn(),
currentPage: jest.fn(() => ({
selection: [],
})),
createPage: jest.fn((title) => ({
name: title,
loadAsync: jest.fn(),
appendChild: jest.fn(),
})),
setCurrentPageAsync: jest.fn(),
ui: {
postMessage: jest.fn(),
},
// 추가적으로 필요한 API 모의
};
7 changes: 0 additions & 7 deletions jset.config.js

This file was deleted.

25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,19 @@
"@eslint/js": "^9.0.0",
"@figma/eslint-plugin-figma-plugins": "*",
"@figma/plugin-typings": "^1.91.0",
"@types/file-saver": "^2.0.7",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/path-browserify": "^1.0.2",
"@types/svg2ttf": "^5.0.3",
"@types/svgicons2svgfont": "^10.0.5",
"@types/ttf2eot": "^2.0.2",
"@types/ttf2woff": "^2.0.4",
"@types/ttf2woff2": "^2.0.2",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"babel-jest": "^29.7.0",
"buffer": "^6.0.3",
"css-loader": "^7.1.1",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -40,11 +48,28 @@
"html-inline-script-webpack-plugin": "^3.2.1",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^24.0.0",
"process": "^0.11.10",
"punycode": "^1.4.1",
"stream-browserify": "^3.0.0",
"style-loader": "^4.0.0",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"file-saver": "^2.0.5",
"fontkit": "^2.0.2",
"jszip": "^3.10.1",
"path-browserify": "^1.0.1",
"svg2ttf": "^6.0.3",
"svgicons2svgfont": "^12.0.0",
"ttf2eot": "^3.1.0",
"ttf2woff": "^3.0.0",
"ttf2woff2": "^5.0.0"
}
}
Loading

0 comments on commit b4b8b9d

Please sign in to comment.