Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] #5 #7

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 0 additions & 44 deletions src/container.js

This file was deleted.

1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export {default as Container} from './container';
export {default as Descriptor} from './descriptor';
export {default as Resource} from './resource';
export {default as Request} from './request';
Expand Down
5 changes: 3 additions & 2 deletions src/resource.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Request from './request';
import {Container} from './';
// import descriptor from './descriptor';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No comment here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, i had already removed the comments on the last commit.


const debug = require('debug')('restinga:resource');

Expand All @@ -25,7 +25,8 @@ export default class Resource {
this.collectionRoot = collectionRoot;
this.itemRoot = itemRoot;

this.descriptor = Container.get(this.service);
const obj = {service: 'json-placeholder', prefix: 'http://jsonplaceholder.typicode.com', agent: 'restinga-node/1.0.0 (https://github.com/jay-ess/restinga-node)'};
Copy link
Contributor

@lubien lubien Dec 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name it const descriptor to be more clear.

Don't make it a one-liner as it's too big.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

this.descriptor = obj || null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're not receiving a descriptor from the user, you're mocking one!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know, for while.


this.attributes = {};

Expand Down
19 changes: 0 additions & 19 deletions test/container.test.js

This file was deleted.

4 changes: 2 additions & 2 deletions test/resource.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import test from 'ava';
import {Container} from '../src';
// import {Container} from '../src';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment, again.

import {JsonPlaceholderService, PostResource, CommentResource} from './fixtures';

const jsonPlaceholderService = new JsonPlaceholderService();

Container.register(jsonPlaceholderService);
// Container.register(jsonPlaceholderService);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again.


test('Resource', t => {
const post = new PostResource();
Expand Down