Skip to content

Commit 96d007d

Browse files
committed
first commit
0 parents  commit 96d007d

23 files changed

+52205
-0
lines changed

.eslintignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
lib/
2+
dist/
3+
node_modules/
4+
coverage/

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* text=auto eol=lf
2+
3+
dist/** -diff linguist-generated=true

.gitignore

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Dependency directory
2+
node_modules
3+
4+
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
13+
# Diagnostic reports (https://nodejs.org/api/report.html)
14+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15+
16+
# Runtime data
17+
pids
18+
*.pid
19+
*.seed
20+
*.pid.lock
21+
22+
# Directory for instrumented libs generated by jscoverage/JSCover
23+
lib-cov
24+
25+
# Coverage directory used by tools like istanbul
26+
coverage
27+
*.lcov
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
jspm_packages/
46+
47+
# TypeScript v1 declaration files
48+
typings/
49+
50+
# TypeScript cache
51+
*.tsbuildinfo
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variables file
69+
.env
70+
.env.test
71+
72+
# parcel-bundler cache (https://parceljs.org/)
73+
.cache
74+
75+
# next.js build output
76+
.next
77+
78+
# nuxt.js build output
79+
.nuxt
80+
81+
# vuepress build output
82+
.vuepress/dist
83+
84+
# Serverless directories
85+
.serverless/
86+
87+
# FuseBox cache
88+
.fusebox/
89+
90+
# DynamoDB Local files
91+
.dynamodb/
92+
93+
# OS metadata
94+
.DS_Store
95+
Thumbs.db
96+
97+
# Ignore built ts files
98+
__tests__/runner/*
99+
100+
# IDE files
101+
.idea
102+
.vscode
103+
*.code-workspace

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
20.6.0

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist/
2+
node_modules/
3+
coverage/

.prettierrc.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": false,
6+
"singleQuote": true,
7+
"quoteProps": "as-needed",
8+
"jsxSingleQuote": false,
9+
"trailingComma": "none",
10+
"bracketSpacing": true,
11+
"bracketSameLine": true,
12+
"arrowParens": "avoid",
13+
"proseWrap": "always",
14+
"htmlWhitespaceSensitivity": "css",
15+
"endOfLine": "lf"
16+
}

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Upload OpenAPI Specification Action
2+
3+
This action will upload your OpenAPI specification to Hey API.

__tests__/index.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Unit tests for the action's entrypoint, src/index.ts
3+
*/
4+
5+
// import * as main from '../src/main'
6+
7+
// // Mock the action's entrypoint
8+
// const runMock = jest.spyOn(main, 'run').mockImplementation()
9+
10+
// describe('index', () => {
11+
// it('calls run when imported', async () => {
12+
// // eslint-disable-next-line @typescript-eslint/no-require-imports
13+
// require('../src/index')
14+
15+
// expect(runMock).toHaveBeenCalled()
16+
// })
17+
// })

__tests__/main.test.ts

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Unit tests for the action's main functionality, src/main.ts
3+
*
4+
* These should be run as if the action was called from a workflow.
5+
* Specifically, the inputs listed in `action.yml` should be set as environment
6+
* variables following the pattern `INPUT_<INPUT_NAME>`.
7+
*/
8+
9+
// import * as core from '@actions/core'
10+
// import * as main from '../src/main'
11+
12+
// // Mock the action's main function
13+
// const runMock = jest.spyOn(main, 'run')
14+
15+
// // Other utilities
16+
// const timeRegex = /^\d{2}:\d{2}:\d{2}/
17+
18+
// // Mock the GitHub Actions core library
19+
// let debugMock: jest.SpiedFunction<typeof core.debug>
20+
// let errorMock: jest.SpiedFunction<typeof core.error>
21+
// let getInputMock: jest.SpiedFunction<typeof core.getInput>
22+
// let setFailedMock: jest.SpiedFunction<typeof core.setFailed>
23+
// let setOutputMock: jest.SpiedFunction<typeof core.setOutput>
24+
25+
// describe('action', () => {
26+
// beforeEach(() => {
27+
// jest.clearAllMocks()
28+
29+
// debugMock = jest.spyOn(core, 'debug').mockImplementation()
30+
// errorMock = jest.spyOn(core, 'error').mockImplementation()
31+
// getInputMock = jest.spyOn(core, 'getInput').mockImplementation()
32+
// setFailedMock = jest.spyOn(core, 'setFailed').mockImplementation()
33+
// setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
34+
// })
35+
36+
// it('sets the time output', async () => {
37+
// // Set the action's inputs as return values from core.getInput()
38+
// getInputMock.mockImplementation(name => {
39+
// switch (name) {
40+
// case 'milliseconds':
41+
// return '500'
42+
// default:
43+
// return ''
44+
// }
45+
// })
46+
47+
// await main.run()
48+
// expect(runMock).toHaveReturned()
49+
50+
// // Verify that all of the core library functions were called correctly
51+
// expect(debugMock).toHaveBeenNthCalledWith(1, 'Waiting 500 milliseconds ...')
52+
// expect(debugMock).toHaveBeenNthCalledWith(
53+
// 2,
54+
// expect.stringMatching(timeRegex)
55+
// )
56+
// expect(debugMock).toHaveBeenNthCalledWith(
57+
// 3,
58+
// expect.stringMatching(timeRegex)
59+
// )
60+
// expect(setOutputMock).toHaveBeenNthCalledWith(
61+
// 1,
62+
// 'time',
63+
// expect.stringMatching(timeRegex)
64+
// )
65+
// expect(errorMock).not.toHaveBeenCalled()
66+
// })
67+
68+
// it('sets a failed status', async () => {
69+
// // Set the action's inputs as return values from core.getInput()
70+
// getInputMock.mockImplementation(name => {
71+
// switch (name) {
72+
// case 'milliseconds':
73+
// return 'this is not a number'
74+
// default:
75+
// return ''
76+
// }
77+
// })
78+
79+
// await main.run()
80+
// expect(runMock).toHaveReturned()
81+
82+
// // Verify that all of the core library functions were called correctly
83+
// expect(setFailedMock).toHaveBeenNthCalledWith(
84+
// 1,
85+
// 'milliseconds not a number'
86+
// )
87+
// expect(errorMock).not.toHaveBeenCalled()
88+
// })
89+
// })

__tests__/wait.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Unit tests for src/wait.ts
3+
*/
4+
5+
// import { wait } from '../src/wait'
6+
// import { expect } from '@jest/globals'
7+
8+
// describe('wait.ts', () => {
9+
// it('throws an invalid number', async () => {
10+
// const input = parseInt('foo', 10)
11+
// expect(isNaN(input)).toBe(true)
12+
13+
// await expect(wait(input)).rejects.toThrow('milliseconds not a number')
14+
// })
15+
16+
// it('waits with a valid number', async () => {
17+
// const start = new Date()
18+
// await wait(500)
19+
// const end = new Date()
20+
21+
// const delta = Math.abs(end.getTime() - start.getTime())
22+
23+
// expect(delta).toBeGreaterThan(450)
24+
// })
25+
// })

0 commit comments

Comments
 (0)