1
+ import { UserAttributes } from "./shared_types" ;
2
+ import { assert } from "chai" ;
3
+
4
+ describe ( "shared_types" , ( ) => {
5
+ describe ( "UserAttributes" , ( ) => {
6
+ it ( "allows any attribute to be defined" , ( ) => {
7
+ const booleanValue : UserAttributes = {
8
+ fixed : true ,
9
+ broken : false
10
+ } ;
11
+ const numberValue : UserAttributes = {
12
+ first : 1 ,
13
+ last : 999
14
+ } ;
15
+ const stringValue : UserAttributes = {
16
+ name : "Rick Sanchez" ,
17
+ dimension : "c137"
18
+ } ;
19
+ const nullValue : UserAttributes = {
20
+ no : null ,
21
+ empty : null
22
+ } ;
23
+ const custom = {
24
+ sidekick1 : "Morty Smith" ,
25
+ sidekick2 : "Summer Smith"
26
+ }
27
+ const objectValue : UserAttributes = {
28
+ custom
29
+ } ;
30
+ assert . isBoolean ( booleanValue . fixed ) ;
31
+ assert . equal ( booleanValue . broken , false ) ;
32
+ assert . isNumber ( numberValue . last )
33
+ assert . equal ( numberValue . last , 999 ) ;
34
+ assert . isString ( stringValue . name ) ;
35
+ assert . equal ( stringValue . dimension , "c137" ) ;
36
+ assert . isNull ( nullValue . no ) ;
37
+ assert . equal ( nullValue . empty , null ) ;
38
+ assert . isObject ( objectValue . custom ) ;
39
+ assert . equal ( objectValue . custom . sidekick1 , "Morty Smith" ) ;
40
+ assert . deepEqual ( objectValue . custom , custom ) ;
41
+ } ) ;
42
+ } ) ;
43
+ } )
0 commit comments