Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Mielcarek committed Aug 8, 2020
2 parents 4e8b390 + 236853a commit a715e01
Show file tree
Hide file tree
Showing 7 changed files with 498 additions and 467 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "model-typescript",
"version": "1.1.1",
"version": "1.1.2",
"description": "TypeScript immutable model",
"keywords": [
"typescript",
Expand Down
12 changes: 12 additions & 0 deletions spec/immutable-model.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class TestWithMutableModel extends ImmutableModel<TestWithMutableModel> {
@Prop public readonly mutable: TestMutableModel;
}

class TestWithOptionalModel extends ImmutableModel<TestWithOptionalModel> {
@Prop public readonly test?: TestModel;
}

describe('Immutable Model', () => {

describe('Instantiation', () => {
Expand Down Expand Up @@ -145,6 +149,14 @@ describe('Immutable Model', () => {
expect(model.mutable).not.toBe(mutableModel);
expect(model.mutable.isFrozen()).toBe(true);
});

it('should do nothing if value provided to optional property of model type is undefined', () => {
const model: TestWithOptionalModel = new TestWithOptionalModel({
test: undefined,
});

expect(model.test).toBeUndefined();
});
});

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

0 comments on commit a715e01

Please sign in to comment.