Skip to content
This repository has been archived by the owner on Mar 20, 2022. It is now read-only.

Commit

Permalink
Merge d0fd0a1 into a4c7e72
Browse files Browse the repository at this point in the history
  • Loading branch information
Mordred committed Apr 3, 2017
2 parents a4c7e72 + d0fd0a1 commit f86b72a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare namespace schema {
export class Entity {
constructor(key: string, definition?: Schema, options?: EntityOptions)
define(definition: Schema): void
key(): string
key: string
}

export class Object {
Expand Down
2 changes: 2 additions & 0 deletions src/__tests__/typescript/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ const tweet = new schema.Entity('tweets', { user: user }, {

const normalizedData = normalize(data, tweet);
const denormalizedData = denormalize(normalizedData.result, tweet, normalizedData.entities);

const isTweet = tweet.key === 'tweets';
5 changes: 5 additions & 0 deletions src/schemas/__tests__/Entity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ describe(`${schema.Entity.name} normalization`, () => {
it('key name must be a string', () => {
expect(() => new schema.Entity(42)).toThrow();
});

it('key getter should return key passed to constructor', () => {
const user = new schema.Entity('users');
expect(user.key === 'users');
});
});

describe('idAttribute', () => {
Expand Down

0 comments on commit f86b72a

Please sign in to comment.