Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: moving the codebase over to our code standards
  • Loading branch information
erunion committed Sep 9, 2021
commit c86b25f5c40728f791477f66a05509f1118ad410
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__tests__/__fixtures__/output
coverage/
node_modules/
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "@readme/eslint-config",
"root": true,
"rules": {
"global-require": "off",
"object-shorthand": "off"
}
}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
*.log
node_modules
coverage*
node_modules/
coverage/
6 changes: 5 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
__tests__
.github/
coverage/
.editorconfig
test
.eslint*
.prettier*
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
__tests__/__fixtures__/output
coverage/
6 changes: 6 additions & 0 deletions __tests__/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@readme/eslint-config/testing",
"rules": {
"jest/no-export": "off"
}
}
54 changes: 29 additions & 25 deletions __tests__/headers.test.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,44 @@
'use strict'

const helpers = require('../src/helpers/headers')
const helpers = require('../src/helpers/headers');

const headers = {
'Content-Type': 'multipart/form-data; boundary=---011000010111000001101001',
accept: 'application/json'
}
accept: 'application/json',
};

describe('Headers', function () {
describe('Headers', () => {
describe('#getHeader', () => {
it('should get a header', () => {
expect(helpers.getHeader(headers, 'content-type')).toStrictEqual('multipart/form-data; boundary=---011000010111000001101001')
expect(helpers.getHeader(headers, 'content-TYPE')).toStrictEqual('multipart/form-data; boundary=---011000010111000001101001')
expect(helpers.getHeader(headers, 'Accept')).toStrictEqual('application/json')
expect(helpers.getHeader(headers, 'content-type')).toStrictEqual(
'multipart/form-data; boundary=---011000010111000001101001'
);

expect(helpers.getHeader(headers, 'content-TYPE')).toStrictEqual(
'multipart/form-data; boundary=---011000010111000001101001'
);

expect(helpers.getHeader(headers, 'Accept')).toStrictEqual('application/json');

expect(helpers.getHeader(headers, 'authorization')).toBeUndefined();
})
})
});
});

describe('#getHeaderName', () => {
it('should get a header name', () => {
expect(helpers.getHeaderName(headers, 'content-type')).toStrictEqual('Content-Type')
expect(helpers.getHeaderName(headers, 'content-TYPE')).toStrictEqual('Content-Type')
expect(helpers.getHeaderName(headers, 'Accept')).toStrictEqual('accept')
expect(helpers.getHeaderName(headers, 'content-type')).toStrictEqual('Content-Type');
expect(helpers.getHeaderName(headers, 'content-TYPE')).toStrictEqual('Content-Type');
expect(helpers.getHeaderName(headers, 'Accept')).toStrictEqual('accept');

expect(helpers.getHeaderName(headers, 'authorization')).toBeUndefined()
})
})
expect(helpers.getHeaderName(headers, 'authorization')).toBeUndefined();
});
});

describe('#hasHeader', () => {
it('should return if a header is present', () => {
expect(helpers.hasHeader(headers, 'content-type')).toBe(true)
expect(helpers.hasHeader(headers, 'content-TYPE')).toBe(true)
expect(helpers.hasHeader(headers, 'Accept')).toBe(true)

expect(helpers.hasHeader(headers, 'authorization')).toBe(false)
})
})
})
expect(helpers.hasHeader(headers, 'content-type')).toBe(true);
expect(helpers.hasHeader(headers, 'content-TYPE')).toBe(true);
expect(helpers.hasHeader(headers, 'Accept')).toBe(true);

expect(helpers.hasHeader(headers, 'authorization')).toBe(false);
});
});
});
231 changes: 0 additions & 231 deletions __tests__/index.js

This file was deleted.

Loading