mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
add test for getCliLoginById
This commit is contained in:
parent
b75b5c2475
commit
069fcdee6c
@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const forge = require('node-forge');
|
||||
|
||||
module.exports = (encryptedToken, key, iv) => {
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gql = require('graphql-tag');
|
||||
|
||||
module.exports = (id, apolloQueryFn) =>
|
||||
|
||||
32
lib/plugins/login/lib/getCliLoginById.test.js
Normal file
32
lib/plugins/login/lib/getCliLoginById.test.js
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
const sinon = require('sinon');
|
||||
const expect = require('chai').expect;
|
||||
const gql = require('graphql-tag');
|
||||
const getCliLoginById = require('./getCliLoginById');
|
||||
|
||||
describe.only('#getCliLoginById()', () => {
|
||||
it('should query for the cliLoginById', () => {
|
||||
const expectedParams = {
|
||||
fetchPolicy: 'network-only',
|
||||
query: gql`
|
||||
query cliLoginById($id: String!) {
|
||||
cliLoginById(id: $id) {
|
||||
encryptedAccessToken
|
||||
encryptedIdToken
|
||||
encryptedRefreshToken
|
||||
encryptedKey
|
||||
encryptedIv
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: { id: 'abc' },
|
||||
};
|
||||
|
||||
const query = sinon.stub().resolves({ data: { cliLoginId: 'abc' } });
|
||||
return getCliLoginById('abc', query).then(data => {
|
||||
expect(data).to.deep.equal({ cliLoginId: 'abc' });
|
||||
expect(query.getCall(0).args[0]).to.deep.equal(expectedParams);
|
||||
});
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user