Skip to content

Commit

Permalink
support Faker 4.1
Browse files Browse the repository at this point in the history
* add database
* add ipv6 in internet
* add dataUri in image
* add iban and bic in finance
* add slug in lorem
  • Loading branch information
deerawan committed May 30, 2017
1 parent 34f7073 commit 4bfbe39
Show file tree
Hide file tree
Showing 14 changed files with 67 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Fake data you can generate:
- address
- commerce
- company
- database
- date
- finance
- hacker
Expand Down
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-faker",
"displayName": "vscode-faker",
"description": "Generate fake data for name, address, lorem ipsum, commerce and much more",
"version": "1.0.1",
"version": "1.1.0",
"publisher": "deerawan",
"engines": {
"vscode": "^0.10.1"
Expand All @@ -24,6 +24,7 @@
"onCommand:faker.address",
"onCommand:faker.commerce",
"onCommand:faker.company",
"onCommand:faker.database",
"onCommand:faker.date",
"onCommand:faker.finance",
"onCommand:faker.hacker",
Expand All @@ -50,6 +51,10 @@
"command": "faker.company",
"title": "Faker: Company"
},
{
"command": "faker.database",
"title": "Faker: Database"
},
{
"command": "faker.date",
"title": "Faker: Date"
Expand Down Expand Up @@ -116,7 +121,7 @@
"vscode": "0.10.x"
},
"dependencies": {
"faker": "^3.1.0",
"faker": "~4.1.0",
"lodash": "^4.17.3"
}
}
16 changes: 16 additions & 0 deletions src/entity/database.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { FakerEntity } from './faker-entity';

export class Database implements FakerEntity {
public getName() {
return 'database';
}

public getMethods() {
return [
'column',
'type',
'collation',
'engine'
];
}
}
4 changes: 3 additions & 1 deletion src/entity/finance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export class Finance implements FakerEntity {
'currencyCode',
'currencyName',
'currencySymbol',
'bitcoinAddress'
'bitcoinAddress',
'iban',
'bic'
];
}
}
3 changes: 2 additions & 1 deletion src/entity/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ export class Image implements FakerEntity {
'nature',
'sports',
'technics',
'transport'
'transport',
'dataUri'
]
}
}
2 changes: 2 additions & 0 deletions src/entity/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { FakerEntity } from './faker-entity';
import { Address } from './address';
import { Commerce } from './commerce';
import { Company } from './company';
import { Database } from './database';
import { Date } from './date';
import { Finance } from './finance';
import { Hacker } from './hacker';
Expand All @@ -18,6 +19,7 @@ export {
Address,
Commerce,
Company,
Database,
Date,
Finance,
Hacker,
Expand Down
1 change: 1 addition & 0 deletions src/entity/internet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export class Internet implements FakerEntity {
'domainSuffix',
'domainWord',
'ip',
'ipv6',
'userAgent',
'color',
'mac',
Expand Down
1 change: 1 addition & 0 deletions src/entity/lorem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class Lorem implements FakerEntity {
'word',
'words',
'sentence',
'slug',
'sentences',
'paragraph',
'paragraphs',
Expand Down
3 changes: 2 additions & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const _ = require('lodash');
const address = new entity.Address();
const commerce = new entity.Commerce();
const company = new entity.Company();
const database = new entity.Database();
const date = new entity.Date();
const finance = new entity.Finance();
const hacker = new entity.Hacker();
Expand All @@ -21,7 +22,7 @@ export function activate(context: ExtensionContext) {
faker.locale = workspace.getConfiguration('faker').get('locale');

let fakerEntities = [
address, commerce, company, date, finance,
address, commerce, company, database, date, finance,
hacker, image, internet, lorem, name,
phone, random, system
];
Expand Down
25 changes: 25 additions & 0 deletions test/entity/database.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const chai = require('chai');
import { Database } from '../../src/entity/database';

const expect = chai.expect;

suite("Database Entity Tests", () => {
let database;

before(function() {
database = new Database();
});

test("has name", () => {
expect(database.getName()).to.equal('database');
});

test("has method", () => {
expect(database.getMethods()).to.eql([
'column',
'type',
'collation',
'engine'
]);
});
});
4 changes: 3 additions & 1 deletion test/entity/finance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ suite("Finance Entity Tests", () => {
'currencyCode',
'currencyName',
'currencySymbol',
'bitcoinAddress'
'bitcoinAddress',
'iban',
'bic'
]);
});
});
3 changes: 2 additions & 1 deletion test/entity/image.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ suite("image Entity Tests", () => {
'nature',
'sports',
'technics',
'transport'
'transport',
'dataUri'
]);
});
});
1 change: 1 addition & 0 deletions test/entity/internet.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ suite("internet Entity Tests", () => {
'domainSuffix',
'domainWord',
'ip',
'ipv6',
'userAgent',
'color',
'mac',
Expand Down
1 change: 1 addition & 0 deletions test/entity/lorem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ suite("lorem Entity Tests", () => {
'word',
'words',
'sentence',
'slug',
'sentences',
'paragraph',
'paragraphs',
Expand Down

0 comments on commit 4bfbe39

Please sign in to comment.