-
-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d1e64d6
commit eccf8b0
Showing
7 changed files
with
112 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 25 additions & 16 deletions
41
test/runtime/runtime-typescript/test/DefaultAddressTest.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
import Address from '../src/defaultExport/Address'; | ||
import NestedObject from '../src/defaultExport/NestedObject'; | ||
import TestObject from '../src/defaultExport/TestObject'; | ||
import ObjectType from '../src/defaultExport/ObjectType'; | ||
import EnumType from '../src/defaultExport/EnumType'; | ||
|
||
describe('Address', () => { | ||
describe('Default exports', () => { | ||
test('should be able to instantiate default export model', () => { | ||
const nestedObj = new NestedObject({ | ||
const objectType = new ObjectType({ | ||
test: 'test' | ||
}); | ||
const address = new Address({ | ||
streetName: 'test', | ||
houseNumber: 1, | ||
marriage: true, | ||
members: 2, | ||
const testObject = new TestObject({ | ||
stringType: 'test', | ||
numberType: 1, | ||
booleanType: true, | ||
arrayType: [1, 'test'], | ||
nestedObject: nestedObj | ||
objectType: objectType, | ||
dictionaryType: new Map(Object.entries({"test": "test"})), | ||
additionalProperties: new Map(Object.entries({"test": "test"})), | ||
enumType: EnumType.CURLYLEFT_QUOTATION_TEST_QUOTATION_COLON_2_CURLYRIGHT, | ||
tupleType: ['test', 1], | ||
unionType: 'test' | ||
}); | ||
expect(address.streetName).toEqual('test'); | ||
expect(address.houseNumber).toEqual(1); | ||
expect(address.marriage).toEqual(true); | ||
expect(address.members).toEqual(2); | ||
expect(address.arrayType).toEqual([1, 'test']); | ||
expect(address.nestedObject?.test).toEqual('test'); | ||
expect(testObject.stringType).toEqual('test'); | ||
expect(testObject.numberType).toEqual(1); | ||
expect(testObject.booleanType).toEqual(true); | ||
expect(testObject.arrayType).toEqual([1, 'test']); | ||
expect(testObject.objectType).toEqual(objectType); | ||
expect(Object.fromEntries(testObject.dictionaryType!)).toEqual({"test": "test"}); | ||
expect(Object.fromEntries(testObject.additionalProperties!)).toEqual({"test": "test"}); | ||
expect(testObject.enumType).toEqual(EnumType.CURLYLEFT_QUOTATION_TEST_QUOTATION_COLON_2_CURLYRIGHT); | ||
expect(testObject.tupleType).toEqual(['test', 1]); | ||
expect(testObject.unionType).toEqual('test'); | ||
}); | ||
}); |
29 changes: 19 additions & 10 deletions
29
test/runtime/runtime-typescript/test/JsonBinPackPreset.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
import { Address } from '../src/jsonbinpack/Address'; | ||
import { ObjectType } from '../src/jsonbinpack/ObjectType'; | ||
import { TestObject } from '../src/jsonbinpack/TestObject'; | ||
import { EnumType } from '../src/jsonbinpack/EnumType'; | ||
|
||
describe('Address', () => { | ||
const address = new Address({ | ||
streetName: 'test', | ||
houseNumber: 1, | ||
marriage: true | ||
describe('JSON binpack', () => { | ||
const objectType = new ObjectType({ | ||
test: 'test' | ||
}); | ||
test('be able to serialize model and turning it back to a model with the same values', async () => { | ||
const serialized = await address.jsonbinSerialize(); | ||
const newAddress = await Address.jsonbinDeserialize(serialized); | ||
expect(address.marshal()).toEqual(newAddress.marshal()); | ||
const testObject = new TestObject({ | ||
stringType: 'test', | ||
numberType: 1, | ||
booleanType: true, | ||
arrayType: ['test'], | ||
objectType: objectType, | ||
enumType: EnumType.CURLYLEFT_QUOTATION_TEST_QUOTATION_COLON_2_CURLYRIGHT, | ||
tupleType: ['test', 1] | ||
}); | ||
test.skip('should be able to serialize model and turning it back to a model with the same values', async () => { | ||
const serialized = await testObject.jsonbinSerialize(); | ||
const newTestObject = await TestObject.jsonbinDeserialize(serialized); | ||
expect(testObject.marshal()).toEqual(newTestObject.marshal()); | ||
}); | ||
}); |
108 changes: 20 additions & 88 deletions
108
test/runtime/runtime-typescript/test/Marshalling.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 25 additions & 16 deletions
41
test/runtime/runtime-typescript/test/NamedAddressTest.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
import { Address } from '../src/namedExport/Address'; | ||
import { NestedObject } from '../src/namedExport/NestedObject'; | ||
import {TestObject} from '../src/namedExport/TestObject'; | ||
import {ObjectType} from '../src/namedExport/ObjectType'; | ||
import {EnumType} from '../src/namedExport/EnumType'; | ||
|
||
describe('Address', () => { | ||
describe('Named exports', () => { | ||
test('should be able to instantiate named export model', () => { | ||
const nestedObj = new NestedObject({ | ||
const objectType = new ObjectType({ | ||
test: 'test' | ||
}); | ||
const address = new Address({ | ||
streetName: 'test', | ||
houseNumber: 1, | ||
marriage: true, | ||
members: 2, | ||
const testObject = new TestObject({ | ||
stringType: 'test', | ||
numberType: 1, | ||
booleanType: true, | ||
arrayType: [1, 'test'], | ||
nestedObject: nestedObj | ||
objectType: objectType, | ||
dictionaryType: new Map(Object.entries({"test": "test"})), | ||
additionalProperties: new Map(Object.entries({"test": "test"})), | ||
enumType: EnumType.CURLYLEFT_QUOTATION_TEST_QUOTATION_COLON_2_CURLYRIGHT, | ||
tupleType: ['test', 1], | ||
unionType: 'test' | ||
}); | ||
expect(address.streetName).toEqual('test'); | ||
expect(address.houseNumber).toEqual(1); | ||
expect(address.marriage).toEqual(true); | ||
expect(address.members).toEqual(2); | ||
expect(address.arrayType).toEqual([1, 'test']); | ||
expect(address.nestedObject?.test).toEqual('test'); | ||
expect(testObject.stringType).toEqual('test'); | ||
expect(testObject.numberType).toEqual(1); | ||
expect(testObject.booleanType).toEqual(true); | ||
expect(testObject.arrayType).toEqual([1, 'test']); | ||
expect(testObject.objectType).toEqual(objectType); | ||
expect(Object.fromEntries(testObject.dictionaryType!)).toEqual({"test": "test"}); | ||
expect(Object.fromEntries(testObject.additionalProperties!)).toEqual({"test": "test"}); | ||
expect(testObject.enumType).toEqual(EnumType.CURLYLEFT_QUOTATION_TEST_QUOTATION_COLON_2_CURLYRIGHT); | ||
expect(testObject.tupleType).toEqual(['test', 1]); | ||
expect(testObject.unionType).toEqual('test'); | ||
}); | ||
}); |