Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-adapter-javascript
Commits
645b90f6
Unverified
Commit
645b90f6
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
refactor: move common steps from auth into common
+ correct the feature description for getAuthorizationHeader
parent
c4d324c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
26 deletions
+25
-26
features/adapter_get-authorization-header.feature
features/adapter_get-authorization-header.feature
+2
-2
test/cucumber/adapter/auth.steps.js
test/cucumber/adapter/auth.steps.js
+1
-23
test/cucumber/adapter/common.steps.js
test/cucumber/adapter/common.steps.js
+22
-1
No files found.
features/adapter_get-authorization-header.feature
View file @
645b90f6
Feature
:
Does
the adapter
authenticate
?
W
he
n an
adapter
instance is created it authenticates and receives a token
Feature
:
Can
the adapter
create an authorization header
?
T
he adapter
getAuthorizationHeader method works as expected
Scenario
:
getAuthorizationHeader returns a bearer token
Given
valid config
...
...
This diff is collapsed.
Click to expand it.
test/cucumber/adapter/auth.steps.js
View file @
645b90f6
const
assert
=
require
(
'
assert
'
);
const
{
Given
,
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
fixtures
}
=
require
(
'
../../fixtures/server
'
);
const
mockValidConfig
=
fixtures
.
get
(
'
config-valid
'
);
const
mockInvalidConfig
=
fixtures
.
get
(
'
config-invalid
'
);
const
mockSchema
=
require
(
'
../../mock/swagger.json
'
);
const
{
Adapter
}
=
require
(
'
../../../dist/adapter
'
);
Given
(
'
valid config
'
,
function
()
{
this
.
config
=
mockValidConfig
});
When
(
'
the adapter instance is created
'
,
function
()
{
//let mockProtocol = new GenericProtocol(this.schema);
let
mockAdapter
=
new
Adapter
(
this
.
protocol
,
this
.
config
);
this
.
adapter
=
mockAdapter
;
});
When
(
'
the auth method is called
'
,
async
function
()
{
await
this
.
adapter
.
auth
();
});
...
...
@@ -28,11 +11,6 @@ Then('the adapter credentials are populated', function() {
assert
.
equal
(
this
.
adapter
.
credentials
.
token
,
fixtures
.
get
(
'
response-valid-token
'
).
token
);
});
Given
(
'
invalid config
'
,
function
()
{
this
.
schema
=
mockSchema
;
this
.
config
=
mockInvalidConfig
;
});
Then
(
'
the adapter auth fails
'
,
function
()
{
this
.
adapter
.
auth
()
.
catch
((
error
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
test/cucumber/adapter/common.steps.js
View file @
645b90f6
const
assert
=
require
(
'
assert
'
);
const
{
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
Given
,
When
,
Then
}
=
require
(
'
@cucumber/cucumber
'
);
const
{
fixtures
}
=
require
(
'
../../fixtures/server
'
);
const
mockValidConfig
=
fixtures
.
get
(
'
config-valid
'
);
const
mockInvalidConfig
=
fixtures
.
get
(
'
config-invalid
'
);
const
mockSchema
=
require
(
'
../../mock/swagger.json
'
);
const
{
Adapter
}
=
require
(
'
../../../dist/adapter
'
);
Given
(
'
valid config
'
,
function
()
{
this
.
config
=
mockValidConfig
});
Given
(
'
invalid config
'
,
function
()
{
this
.
schema
=
mockSchema
;
this
.
config
=
mockInvalidConfig
;
});
When
(
'
the adapter instance is created
'
,
function
()
{
let
mockAdapter
=
new
Adapter
(
this
.
protocol
,
this
.
config
);
this
.
adapter
=
mockAdapter
;
});
Then
(
'
a successful response is returned with status {int}
'
,
function
(
expectedStatus
)
{
this
.
call
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment