-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Eslint for E2E and Nuget Updates (#22)
- Loading branch information
Showing
12 changed files
with
1,484 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# don't ever lint node_modules | ||
node_modules | ||
# don't lint build output (make sure it's set to your correct build folder name) | ||
dist | ||
# don't lint nyc coverage output | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ | ||
"root": true, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2019, | ||
"project": ["./tsconfig.json"] | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint", | ||
"unicorn", | ||
"promise", | ||
"prettier", | ||
"jest" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:node/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:import/typescript", | ||
"plugin:unicorn/recommended", | ||
"plugin:prettier/recommended", | ||
"plugin:promise/recommended", | ||
"plugin:jest/style" | ||
], | ||
"rules": { | ||
"import/order": "error", | ||
"node/no-unsupported-features/es-syntax": "off", | ||
"node/no-unpublished-import": "off", | ||
"unicorn/prevent-abbreviations": ["error", { | ||
"checkFilenames": false | ||
}] | ||
}, | ||
"settings": { | ||
"node": { | ||
"allowModules": [ | ||
"chai", | ||
"wait-on" | ||
], | ||
"tryExtensions": [".ts", ".json", ".node"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import waitOn = require('wait-on'); | ||
|
||
before('waiting for oidc server & airbag', async function () { | ||
this.timeout(10000); | ||
await waitOn({ | ||
resources: [`tcp:oidc-server-mock:80`], | ||
// tslint:disable-next-line:object-literal-sort-keys | ||
delay: 1000, | ||
interval: 100, | ||
timeout: 60000, | ||
window: 1000, | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,32 @@ | ||
import axios from "axios"; | ||
import { expect } from "chai"; | ||
import * as querystring from "querystring"; | ||
import { decode } from "jws"; | ||
import * as querystring from 'querystring'; | ||
import axios from 'axios'; | ||
import { expect } from 'chai'; | ||
import { decode } from 'jws'; | ||
|
||
describe("Test", () => { | ||
it("should work", async () => { | ||
const { CLIENT_CREDENTIALS_CLIENT_ID, CLIENT_CREDENTIALS_CLIENT_SECRET, API_RESOURCE } = process.env; | ||
const params = { | ||
client_id: CLIENT_CREDENTIALS_CLIENT_ID, | ||
client_secret: CLIENT_CREDENTIALS_CLIENT_SECRET, | ||
grant_type: "client_credentials", | ||
scope: API_RESOURCE, | ||
describe('Test', () => { | ||
it('should work', async () => { | ||
const { CLIENT_CREDENTIALS_CLIENT_ID, CLIENT_CREDENTIALS_CLIENT_SECRET, API_RESOURCE } = process.env; | ||
const parameters = { | ||
client_id: CLIENT_CREDENTIALS_CLIENT_ID, | ||
client_secret: CLIENT_CREDENTIALS_CLIENT_SECRET, | ||
grant_type: 'client_credentials', | ||
scope: API_RESOURCE, | ||
}; | ||
|
||
const response = await axios.post(process.env.OIDC_TOKEN_URL, querystring.stringify(params)); | ||
const response = await axios.post(process.env.OIDC_TOKEN_URL, querystring.stringify(parameters)); | ||
|
||
// tslint:disable-next-line:no-unused-expression | ||
expect(response).to.exist; | ||
// tslint:disable-next-line:no-unused-expression | ||
expect(response.data.access_token).to.exist; | ||
const token = decode(response.data.access_token); | ||
// tslint:disable-next-line:no-unused-expression | ||
expect(response).to.exist; | ||
// tslint:disable-next-line:no-unused-expression | ||
expect(response.data.access_token).to.exist; | ||
const token = decode(response.data.access_token); | ||
|
||
expect(token.header.typ).to.equal('JWT'); | ||
expect(token.payload['iss']).to.equal('http://oidc-server-mock'); | ||
expect(token.payload['aud']).to.equal('user-service'); | ||
expect(token.payload['scope']).to.deep.equal([ 'user-service-scope' ]) | ||
expect(token.payload['client_id']).to.equal('e2e-client-id'); | ||
expect(token.payload['string_claim']).to.equal('string_claim_value'); | ||
expect(token.payload['json_claim']).to.deep.equal(['value1', 'value2']); | ||
}); | ||
expect(token.header.typ).to.equal('JWT'); | ||
expect(token.payload['iss']).to.equal('http://oidc-server-mock'); | ||
expect(token.payload['aud']).to.equal('user-service'); | ||
expect(token.payload['scope']).to.deep.equal(['user-service-scope']); | ||
expect(token.payload['client_id']).to.equal('e2e-client-id'); | ||
expect(token.payload['string_claim']).to.equal('string_claim_value'); | ||
expect(token.payload['json_claim']).to.deep.equal(['value1', 'value2']); | ||
}); | ||
}); |
Oops, something went wrong.