Skip to content

Commit

Permalink
add fiels in model-client
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelvilche committed Aug 13, 2019
1 parent aaef842 commit f93e155
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules/
.nyc_output/
config/
config/
coverage/
2 changes: 1 addition & 1 deletion .nycrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"exclude": [
"coverages/",
"coverage/",
"tests/",
"mocks/",
".eslintrc.js",
Expand Down
7 changes: 7 additions & 0 deletions lib/model-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ class ModelClient extends Model {
return this.settings.table || 'clients';
}

static get fields() {
return {
name: true,
storename: true
};
}

async getByField(field, value) {

if(!field || !value)
Expand Down
8 changes: 8 additions & 0 deletions tests/model-client-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,12 @@ describe('ModelClient', () => {
assertSettingsCall();
});

it('should return a object when calling fields method', async () => {

assert.deepStrictEqual(ModelClient.fields, {
name: true,
storename: true
});
});

});

0 comments on commit f93e155

Please sign in to comment.