Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Update ember-a11y-testing #9912

Merged
merged 3 commits into from
Feb 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions ui/app/adapters/watchable.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default class Watchable extends ApplicationAdapter {
signal,
data: params,
}).catch(error => {
if (error instanceof AbortError) {
if (error instanceof AbortError || error.name == 'AbortError') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. These make me sad, but they're definitely not the end of the world. I think I'll open an issue tracking this particular thing. I wouldn't want to block the Ember and related deps work on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya, I don’t love it, a new issue sounds good to me so I can proceed through this slog 😆💞

return;
}
throw error;
Expand Down Expand Up @@ -149,7 +149,7 @@ export default class Watchable extends ApplicationAdapter {
store.push(normalizedData);
},
error => {
if (error instanceof AbortError) {
if (error instanceof AbortError || error.name === 'AbortError') {
return relationship.kind === 'belongsTo' ? {} : [];
}
throw error;
Expand Down
6 changes: 3 additions & 3 deletions ui/mirage/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export default function() {
});

this.get('/acl/token/self', function({ tokens }, req) {
const secret = req.requestHeaders['x-nomad-token'];
const secret = req.requestHeaders['X-Nomad-Token'];
const tokenForSecret = tokens.findBy({ secretId: secret });

// Return the token if it exists
Expand All @@ -366,7 +366,7 @@ export default function() {

this.get('/acl/token/:id', function({ tokens }, req) {
const token = tokens.find(req.params.id);
const secret = req.requestHeaders['x-nomad-token'];
const secret = req.requestHeaders['X-Nomad-Token'];
const tokenForSecret = tokens.findBy({ secretId: secret });

// Return the token only if the request header matches the token
Expand All @@ -381,7 +381,7 @@ export default function() {

this.get('/acl/policy/:id', function({ policies, tokens }, req) {
const policy = policies.find(req.params.id);
const secret = req.requestHeaders['x-nomad-token'];
const secret = req.requestHeaders['X-Nomad-Token'];
const tokenForSecret = tokens.findBy({ secretId: secret });

if (req.params.id === 'anonymous') {
Expand Down
5 changes: 3 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"devDependencies": {
"@babel/plugin-proposal-object-rest-spread": "^7.4.3",
"@ember/optional-features": "^1.3.0",
"@ember/test-helpers": "^2.0.0",
"@glimmer/component": "^1.0.0",
"@glimmer/tracking": "^1.0.0",
"@hashicorp/structure-icons": "^1.3.0",
Expand All @@ -52,7 +53,7 @@
"d3-time-format": "^2.1.0",
"d3-transition": "^1.1.0",
"duration-js": "^4.0.0",
"ember-a11y-testing": "^3.0.2",
"ember-a11y-testing": "^4.0.0",
"ember-auto-import": "^1.5.3",
"ember-can": "^2.0.0",
"ember-classic-decorator": "^1.0.8",
Expand All @@ -79,7 +80,7 @@
"ember-data-model-fragments": "4.0.0",
"ember-decorators": "^6.1.1",
"ember-export-application-global": "^2.0.1",
"ember-fetch": "^7.0.0",
"ember-fetch": "^8.0.2",
"ember-inflector": "^3.0.0",
"ember-inline-svg": "^0.3.0",
"ember-load-initializers": "^2.1.1",
Expand Down
8 changes: 4 additions & 4 deletions ui/tests/unit/adapters/job-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ module('Unit | Adapter | Job', function(hooks) {
);
});

test('When there is no token set in the token service, no x-nomad-token header is set', async function(assert) {
test('When there is no token set in the token service, no X-Nomad-Token header is set', async function(assert) {
await this.initializeUI();

const { pretender } = this.server;
Expand All @@ -143,12 +143,12 @@ module('Unit | Adapter | Job', function(hooks) {
await settled();

assert.notOk(
pretender.handledRequests.mapBy('requestHeaders').some(headers => headers['x-nomad-token']),
pretender.handledRequests.mapBy('requestHeaders').some(headers => headers['X-Nomad-Token']),
'No token header present on either job request'
);
});

test('When a token is set in the token service, then x-nomad-token header is set', async function(assert) {
test('When a token is set in the token service, then X-Nomad-Token header is set', async function(assert) {
await this.initializeUI();

const { pretender } = this.server;
Expand All @@ -162,7 +162,7 @@ module('Unit | Adapter | Job', function(hooks) {
assert.ok(
pretender.handledRequests
.mapBy('requestHeaders')
.every(headers => headers['x-nomad-token'] === secret),
.every(headers => headers['X-Nomad-Token'] === secret),
'The token header is present on both job requests'
);
});
Expand Down