diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 2186947..0000000 --- a/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -dist/ -lib/ -node_modules/ \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 1a8e951..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "plugins": ["jest", "@typescript-eslint"], - "extends": ["plugin:github/recommended"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 9, - "sourceType": "module", - "project": "./tsconfig.json" - }, - "rules": { - "eslint-comments/no-use": "off", - "import/no-namespace": "off", - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": "error", - "@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], - "@typescript-eslint/no-require-imports": "error", - "@typescript-eslint/array-type": "error", - "@typescript-eslint/await-thenable": "error", - "@typescript-eslint/ban-ts-comment": "error", - "camelcase": "off", - "@typescript-eslint/consistent-type-assertions": "error", - "@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}], - "@typescript-eslint/func-call-spacing": ["error", "never"], - "@typescript-eslint/no-array-constructor": "error", - "@typescript-eslint/no-empty-interface": "error", - "@typescript-eslint/no-explicit-any": "error", - "@typescript-eslint/no-extraneous-class": "error", - "@typescript-eslint/no-for-in-array": "error", - "@typescript-eslint/no-inferrable-types": "error", - "@typescript-eslint/no-misused-new": "error", - "@typescript-eslint/no-namespace": "error", - "@typescript-eslint/no-non-null-assertion": "warn", - "@typescript-eslint/no-unnecessary-qualifier": "error", - "@typescript-eslint/no-unnecessary-type-assertion": "error", - "@typescript-eslint/no-useless-constructor": "error", - "@typescript-eslint/no-var-requires": "error", - "@typescript-eslint/prefer-for-of": "warn", - "@typescript-eslint/prefer-function-type": "warn", - "@typescript-eslint/prefer-includes": "error", - "@typescript-eslint/prefer-string-starts-ends-with": "error", - "@typescript-eslint/promise-function-async": "error", - "@typescript-eslint/require-array-sort-compare": "error", - "@typescript-eslint/restrict-plus-operands": "error", - "semi": "off", - "@typescript-eslint/semi": ["error", "never"], - "@typescript-eslint/type-annotation-spacing": "error", - "@typescript-eslint/unbound-method": "error" - }, - "env": { - "node": true, - "es6": true, - "jest/globals": true - } - } \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57df002..ae5bafd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,15 +4,8 @@ jobs: runs-on: ubuntu-latest name: StackGuardian Github Action steps: - # To use this repository's private action, - # you must check out the repository - - name: StackGuardian/workflow-run-action - uses: actions/checkout@v4 - name: StackGuardian/workflow-run-action uses: ./ # Uses an action in the root directory id: StackGuardian-CLI with: - sg-cmd: "workflow help" - # # Use the output from the `hello` step - # - name: Get the output time - # run: echo "The time was ${{ steps.hello.outputs.time }}" + sg-cmd: "workflow help" \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index c34bafc..0000000 --- a/.prettierrc.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "printWidth": 80, - "tabWidth": 2, - "useTabs": false, - "semi": false, - "singleQuote": true, - "trailingComma": "none", - "bracketSpacing": false, - "arrowParens": "avoid" -} diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts deleted file mode 100644 index bc84e11..0000000 --- a/__tests__/main.test.ts +++ /dev/null @@ -1,59 +0,0 @@ -import * as service from '../src/service' -import axios from 'axios' - -// mock axios -jest.mock('axios') -const mockedAxios = axios as jest.Mocked - -// const systemResponse_SUCCESS = {"systems": [{"id": 10, "name": "fake-system"}]}; -// const environmentResponse_SUCCESS = {"environments": [ {"id": 29, "name": "fake-environment", "systemId": 10 }]} -// const instanceResponse_SUCCESS = {"instances": [{"id": 131, "name": "fake-instance"}]}; -// const provision_SUCCESS = { -// "environmentId": 29, -// "instanceId": 131, -// "abortOnFailure": true, -// "steps": [ -// { -// "percent": 0, -// "stepId": 0, -// "description": "string", -// "name": "string", -// "result": "SUCCESS" -// } -// ], -// "status": "SUCCESS", -// "eventId": 0 -// } -// const getProvision_SUCCESS = {"eventId": 1, "environmentId": 29, "instanceId": 131, "abortOnFailure": true, "status": "success", "steps": []}; - -// sanity check -test('Sanity check', () => { - expect(true).toBe(true) -}) - -describe('Test a single deployment', () => { - // variables - let apiKey: string = 'sgu_Efza8ZO5NLe8kT1PfU7KK' - let endpoint: string = - 'https://testapi.qa.stackguardian.io/api/v1/orgs/policies/wfgrps/testing/wfs/s3/wfruns/' - const context = '' - let auth: service.Authorization = {api_key: apiKey} - - // defined the service - var sgService = new service.WebService(endpoint, context, auth) - it('Successful API call', async () => { - const mockResponse = { - data: { - msg: 'Workflow Run scheduled' - } - } - - mockedAxios.post.mockResolvedValue(mockResponse) - - const {data, msg, error} = await sgService.WorkflowRun() - console.log('msg: ', msg) - // expect(axios.post).toHaveBeenCalledWith(endpoint); - expect(msg).toEqual(mockResponse.data.msg) - expect(error).toEqual(null) - }) -})