mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Fixed tests and added fixtures from Ghost repo
This commit is contained in:
parent
320d1f7653
commit
5c47d725cb
4 changed files with 15 additions and 7 deletions
3
ghost/members-csv/test/fixtures/single-column-with-header.csv
vendored
Normal file
3
ghost/members-csv/test/fixtures/single-column-with-header.csv
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
email
|
||||||
|
jbloggs@example.com
|
||||||
|
test@example.com
|
|
3
ghost/members-csv/test/fixtures/two-columns-obscure-header.csv
vendored
Normal file
3
ghost/members-csv/test/fixtures/two-columns-obscure-header.csv
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
id,Email Address
|
||||||
|
1,"jbloggs@example.com"
|
||||||
|
2,test@example.com
|
|
3
ghost/members-csv/test/fixtures/two-columns-with-header.csv
vendored
Normal file
3
ghost/members-csv/test/fixtures/two-columns-with-header.csv
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
id,email
|
||||||
|
1,"jbloggs@example.com"
|
||||||
|
1,test@example.com
|
|
|
@ -1,12 +1,11 @@
|
||||||
const should = require('should');
|
const should = require('should');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const fsLib = require('../../../../../../../../core/server/api/canary/utils/serializers/input/utils/members-import-csv');
|
const {readCSV} = require('../parse');
|
||||||
|
const csvPath = path.join(__dirname, '/fixtures/');
|
||||||
|
|
||||||
const csvPath = path.join(__dirname, '../../../../../../../utils/fixtures/csv/');
|
describe('read csv', function () {
|
||||||
|
|
||||||
describe('members-import-csv: read csv', function () {
|
|
||||||
it('read csv: one column', function (done) {
|
it('read csv: one column', function (done) {
|
||||||
fsLib.readCSV({
|
readCSV({
|
||||||
path: csvPath + 'single-column-with-header.csv',
|
path: csvPath + 'single-column-with-header.csv',
|
||||||
columnsToExtract: [{name: 'email', lookup: /email/i}]
|
columnsToExtract: [{name: 'email', lookup: /email/i}]
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
|
@ -19,7 +18,7 @@ describe('members-import-csv: read csv', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('read csv: two columns, 1 filter', function (done) {
|
it('read csv: two columns, 1 filter', function (done) {
|
||||||
fsLib.readCSV({
|
readCSV({
|
||||||
path: csvPath + 'two-columns-with-header.csv',
|
path: csvPath + 'two-columns-with-header.csv',
|
||||||
columnsToExtract: [{name: 'email', lookup: /email/i}]
|
columnsToExtract: [{name: 'email', lookup: /email/i}]
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
|
@ -34,7 +33,7 @@ describe('members-import-csv: read csv', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('read csv: two columns, 2 filters', function (done) {
|
it('read csv: two columns, 2 filters', function (done) {
|
||||||
fsLib.readCSV({
|
readCSV({
|
||||||
path: csvPath + 'two-columns-obscure-header.csv',
|
path: csvPath + 'two-columns-obscure-header.csv',
|
||||||
columnsToExtract: [
|
columnsToExtract: [
|
||||||
{name: 'email', lookup: /email/i},
|
{name: 'email', lookup: /email/i},
|
||||||
|
|
Loading…
Add table
Reference in a new issue