Best JavaScript code snippet using pact-foundation-pact
index.test.js
Source:index.test.js
...13 }14 `;15 const result = parse(sqltext);16 expect(result).toEqual(17 expect.arrayContaining([18 expect.objectContaining({ type: "table", name: "users" }),19 expect.objectContaining({ type: "table", name: "roles", alias: "R" }),20 expect.objectContaining({ type: "table", name: "categories" }),21 ])22 );23});24test("Table Columns Parsing", () => {25 const sqltext = `26 table users {27 id integer28 name text29 created_at datetime30 height decimal(1, 2)31 }32 table roles as R 33 {34 id integer35 role varchar36 permissions JSON37 }38 `;39 const result = parse(sqltext);40 expect(result).toEqual(41 expect.arrayContaining([42 expect.objectContaining({43 type: "table",44 name: "users",45 columns: expect.arrayContaining([46 expect.objectContaining({ name: "id", variable_type: "integer" }),47 expect.objectContaining({ name: "name", variable_type: "text" }),48 expect.objectContaining({49 name: "created_at",50 variable_type: "datetime",51 }),52 expect.objectContaining({53 name: "height",54 variable_type: "decimal(1,2)",55 }),56 ]),57 }),58 expect.objectContaining({59 type: "table",60 name: "roles",61 alias: "R",62 columns: expect.arrayContaining([63 expect.objectContaining({ name: "id", variable_type: "integer" }),64 expect.objectContaining({ name: "role", variable_type: "varchar" }),65 expect.objectContaining({66 name: "permissions",67 variable_type: "JSON",68 }),69 ]),70 }),71 ])72 );73});74test("Short References Parsing", () => {75 const sqltext = `76 table companies {77 id integer78 }79 table users {80 id integer81 company_id integer82 }83 table user_infos {84 id integer85 user_id integer86 }87 table roles {88 id integer89 user_id integer90 }91 ref: users.id < roles.user_id92 ref: users.company_id > companies.id93 ref: users.id - users_info.user_id94 `;95 const result = parse(sqltext);96 expect(result).toEqual(97 expect.arrayContaining([98 expect.objectContaining({99 type: "table",100 name: "users",101 }),102 expect.objectContaining({103 type: "table",104 name: "roles",105 }),106 expect.objectContaining({107 type: "relationship",108 primary: expect.objectContaining({ table: "users", column: "id" }),109 foreign: expect.objectContaining({ table: "roles", column: "user_id" }),110 }),111 expect.objectContaining({112 type: "relationship",113 primary: expect.objectContaining({ table: "companies", column: "id" }),114 foreign: expect.objectContaining({115 table: "users",116 column: "company_id",117 }),118 }),119 expect.objectContaining({120 type: "relationship",121 primary: expect.objectContaining({ table: "users", column: "id" }),122 isOneToOne: true,123 foreign: expect.objectContaining({124 table: "users_info",125 column: "user_id",126 }),127 }),128 ])129 );130});131test("Basic Columns Settings", () => {132 const sqltext = `133 table users {134 id integer [pk]135 name varchar(20) [not null]136 email varchar [not null, unique]137 address text [null]138 }139 table roles {140 id integer [primary key] 141 }142 table products {143 id integer [pk, increment] 144 }145 `;146 const result = parse(sqltext);147 expect(result).toEqual(148 expect.arrayContaining([149 expect.objectContaining({150 type: "table",151 name: "users",152 columns: expect.arrayContaining([153 expect.objectContaining({154 name: "id",155 variable_type: "integer",156 settings: expect.arrayContaining([157 expect.objectContaining({158 type: "setting",159 value: "primary",160 }),161 ]),162 }),163 expect.objectContaining({164 name: "name",165 variable_type: "varchar(20)",166 settings: expect.arrayContaining([167 expect.objectContaining({168 type: "setting",169 value: "not null",170 }),171 ]),172 }),173 expect.objectContaining({174 name: "email",175 variable_type: "varchar",176 settings: expect.arrayContaining([177 expect.objectContaining({178 type: "setting",179 value: "not null",180 }),181 expect.objectContaining({182 type: "setting",183 value: "unique",184 }),185 ]),186 }),187 expect.objectContaining({188 name: "address",189 variable_type: "text",190 settings: expect.arrayContaining([191 expect.objectContaining({192 type: "setting",193 value: "null",194 }),195 ]),196 }),197 ]),198 }),199 expect.objectContaining({200 type: "table",201 name: "roles",202 columns: expect.arrayContaining([203 expect.objectContaining({204 name: "id",205 variable_type: "integer",206 settings: expect.arrayContaining([207 expect.objectContaining({208 type: "setting",209 value: "primary",210 }),211 ]),212 }),213 ]),214 }),215 expect.objectContaining({216 type: "table",217 name: "products",218 columns: expect.arrayContaining([219 expect.objectContaining({220 name: "id",221 variable_type: "integer",222 settings: expect.arrayContaining([223 expect.objectContaining({224 type: "setting",225 value: "primary",226 }),227 expect.objectContaining({228 type: "setting",229 value: "increment",230 }),231 ]),232 }),233 ]),234 }),235 ])236 );237});238test("Note Columns Settings", () => {239 const sqltext = `240 table users {241 id integer [pk, note: 'user id']242 name varchar(20) [not null, note: "user name"]243 email varchar [not null, unique]244 }245 `;246 const result = parse(sqltext);247 expect(result).toEqual(248 expect.arrayContaining([249 expect.objectContaining({250 type: "table",251 name: "users",252 columns: expect.arrayContaining([253 expect.objectContaining({254 name: "id",255 variable_type: "integer",256 settings: expect.arrayContaining([257 expect.objectContaining({258 type: "setting",259 value: "primary",260 }),261 expect.objectContaining({262 type: "note",263 value: "user id",264 }),265 ]),266 }),267 expect.objectContaining({268 name: "name",269 variable_type: "varchar(20)",270 settings: expect.arrayContaining([271 expect.objectContaining({272 type: "setting",273 value: "not null",274 }),275 expect.objectContaining({276 type: "note",277 value: "user name",278 }),279 ]),280 }),281 expect.objectContaining({282 name: "email",283 variable_type: "varchar",284 settings: expect.arrayContaining([285 expect.objectContaining({286 type: "setting",287 value: "not null",288 }),289 expect.objectContaining({290 type: "setting",291 value: "unique",292 }),293 ]),294 }),295 ]),296 }),297 ])298 );299});300test("Default Columns Settings", () => {301 const sqltext = `302 table users {303 id integer [primary key]304 username varchar(255) [not null, unique, default: 'user_name login']305 full_name varchar(255) [not null]306 gender varchar(1) [default: 'm']307 created_at timestamp [default: \`now()\`]308 rating integer [default: 10]309 average double [default: 1.5]310 }311 `;312 const result = parse(sqltext);313 expect(result).toEqual(314 expect.arrayContaining([315 expect.objectContaining({316 type: "table",317 name: "users",318 columns: expect.arrayContaining([319 expect.objectContaining({320 name: "id",321 variable_type: "integer",322 settings: expect.arrayContaining([323 expect.objectContaining({324 type: "setting",325 value: "primary",326 }),327 ]),328 }),329 expect.objectContaining({330 name: "username",331 variable_type: "varchar(255)",332 settings: expect.arrayContaining([333 expect.objectContaining({334 type: "setting",335 value: "not null",336 }),337 expect.objectContaining({338 type: "setting",339 value: "unique",340 }),341 expect.objectContaining({342 type: "default",343 value: "user_name login",344 }),345 ]),346 }),347 expect.objectContaining({348 name: "full_name",349 variable_type: "varchar(255)",350 settings: expect.arrayContaining([351 expect.objectContaining({352 type: "setting",353 value: "not null",354 }),355 ]),356 }),357 expect.objectContaining({358 name: "gender",359 variable_type: "varchar(1)",360 settings: expect.arrayContaining([361 expect.objectContaining({362 type: "default",363 value: "m",364 }),365 ]),366 }),367 expect.objectContaining({368 name: "created_at",369 variable_type: "timestamp",370 settings: expect.arrayContaining([371 expect.objectContaining({372 type: "default",373 value: "now()",374 expression: true,375 }),376 ]),377 }),378 expect.objectContaining({379 name: "rating",380 variable_type: "integer",381 settings: expect.arrayContaining([382 expect.objectContaining({383 type: "default",384 value: 10,385 }),386 ]),387 }),388 expect.objectContaining({389 name: "average",390 variable_type: "double",391 settings: expect.arrayContaining([392 expect.objectContaining({393 type: "default",394 value: 1.5,395 }),396 ]),397 }),398 ]),399 }),400 ])401 );402});403test("Inline Ref Columns Settings", () => {404 const sqltext = `405 table users {406 id integer [pk, ref: < likes.user_id, ref: < posts.user_id]407 name varchar(20) [not null]408 email varchar [not null, unique]409 address text [null]410 user_info integer [ref: - user_infos.user_id]411 }412 table roles {413 id integer [primary key] 414 user_id integer [ref: > users.id ]415 }416 `;417 const result = parse(sqltext);418 expect(result).toEqual(419 expect.arrayContaining([420 expect.objectContaining({421 type: "table",422 name: "users",423 columns: expect.arrayContaining([424 expect.objectContaining({425 name: "id",426 variable_type: "integer",427 settings: expect.arrayContaining([428 expect.objectContaining({429 type: "setting",430 value: "primary",431 }),432 expect.objectContaining({433 type: "inline_relationship",434 cardinality: "one-to-many",435 table: "likes",436 column: "user_id",437 }),438 expect.objectContaining({439 type: "inline_relationship",440 cardinality: "one-to-many",441 table: "posts",442 column: "user_id",443 }),444 ]),445 }),446 expect.objectContaining({447 name: "name",448 variable_type: "varchar(20)",449 settings: expect.arrayContaining([450 expect.objectContaining({451 type: "setting",452 value: "not null",453 }),454 ]),455 }),456 expect.objectContaining({457 name: "email",458 variable_type: "varchar",459 settings: expect.arrayContaining([460 expect.objectContaining({461 type: "setting",462 value: "not null",463 }),464 expect.objectContaining({465 type: "setting",466 value: "unique",467 }),468 ]),469 }),470 expect.objectContaining({471 name: "address",472 variable_type: "text",473 settings: expect.arrayContaining([474 expect.objectContaining({475 type: "setting",476 value: "null",477 }),478 ]),479 }),480 expect.objectContaining({481 name: "user_info",482 variable_type: "integer",483 settings: expect.arrayContaining([484 expect.objectContaining({485 type: "inline_relationship",486 cardinality: "one-to-one",487 table: "user_infos",488 column: "user_id",489 }),490 ]),491 }),492 ]),493 }),494 expect.objectContaining({495 type: "table",496 name: "roles",497 columns: expect.arrayContaining([498 expect.objectContaining({499 name: "id",500 variable_type: "integer",501 settings: expect.arrayContaining([502 expect.objectContaining({503 type: "setting",504 value: "primary",505 }),506 ]),507 }),508 expect.objectContaining({509 name: "user_id",510 variable_type: "integer",511 settings: expect.arrayContaining([512 expect.objectContaining({513 type: "inline_relationship",514 cardinality: "many-to-one",515 table: "users",516 column: "id",517 }),518 ]),519 }),520 ]),521 }),522 ])523 );524});525test("Table Notes Parsing", () => {526 const sqltext = `527 table users {528 id integer [note: "user id"]529 note: 'this is a note'530 }531 table infos {532 id integer533 note: "this is info"534 }535 table infos_users {536 id integer537 note: '''pivot infos'''538 }539 table likes {540 id integer541 user_id integer542 note { 543 "relation user"544 }545 }546 table roles as R {547 id integer548 }549 `;550 const result = parse(sqltext);551 expect(result).toEqual(552 expect.arrayContaining([553 expect.objectContaining({554 type: "table",555 name: "users",556 note: "this is a note",557 columns: expect.arrayContaining([558 expect.objectContaining({559 type: "column",560 name: "id",561 settings: expect.arrayContaining([562 expect.objectContaining({563 type: "note",564 value: "user id",565 }),566 ]),567 }),568 ]),569 }),570 expect.objectContaining({571 type: "table",572 name: "infos",573 note: "this is info",574 }),575 expect.objectContaining({576 type: "table",577 name: "infos_users",578 note: "pivot infos",579 }),580 expect.objectContaining({581 type: "table",582 name: "likes",583 note: "relation user",584 }),585 expect.objectContaining({ type: "table", name: "roles", alias: "R" }),586 ])587 );588});589test("Table Index", () => {590 const sqltext = `591 table products {592 id int [pk]593 name varchar594 merchant_id int [not null]595 price int596 status products_status597 created_at datetime [default: \`now()\`]598 update_at datetime [default: \`now()\`]599 arrive_date date600 indexes { 601 id602 \`id*2\`603 (id, country)604 (\`id*2\`)605 (\`id*3\`,\`getdate()\`)606 (\`id*3\`,id)607 id [pk]608 (country, booking_date) [unique]609 created_at [note: 'Date']610 updated_at [note: "Update Date"]611 (merchant_id, status) [unique, note: 'inventory status', name: "inventory status"]612 arrive_date [type: hash, note: "mail arrive"]613 614 }615 note {616 '''multiline note'''}617 }618 table users619 {620 id primary621 note {"user note"}622 623 indexes {624 id625 }626 }627 `;628 const result = parse(sqltext);629 //Spaces NL and Index630 expect(result).toEqual(631 expect.arrayContaining([632 expect.objectContaining({633 type: "table",634 name: "users",635 note: "user note",636 indexes: expect.arrayContaining([637 expect.objectContaining({638 fields: expect.arrayContaining([639 expect.objectContaining({640 type: "field",641 field: "id",642 }),643 ]),644 }),645 ]),646 }),647 ])648 );649 //Indexes without Settings650 expect(result).toEqual(651 expect.arrayContaining([652 expect.objectContaining({653 type: "table",654 name: "products",655 indexes: expect.arrayContaining([656 expect.objectContaining({657 fields: expect.arrayContaining([658 expect.objectContaining({659 type: "field",660 field: "id",661 }),662 ]),663 }),664 expect.objectContaining({665 fields: expect.arrayContaining([666 expect.objectContaining({667 type: "field",668 field: "id*2",669 isExpression: true,670 }),671 ]),672 }),673 expect.objectContaining({674 fields: expect.arrayContaining([675 expect.objectContaining({676 type: "field",677 field: "id",678 }),679 expect.objectContaining({680 type: "field",681 field: "country",682 }),683 ]),684 }),685 expect.objectContaining({686 fields: expect.arrayContaining([687 expect.objectContaining({688 type: "field",689 field: "id*2",690 isExpression: true,691 }),692 ]),693 }),694 expect.objectContaining({695 fields: expect.arrayContaining([696 expect.objectContaining({697 type: "field",698 field: "id*3",699 isExpression: true,700 }),701 expect.objectContaining({702 type: "field",703 field: "getdate()",704 isExpression: true,705 }),706 ]),707 }),708 expect.objectContaining({709 fields: expect.arrayContaining([710 expect.objectContaining({711 type: "field",712 field: "id*3",713 isExpression: true,714 }),715 expect.objectContaining({716 type: "field",717 field: "id",718 }),719 ]),720 }),721 ]),722 }),723 ])724 );725 //Index Settings726 expect(result).toEqual(727 expect.arrayContaining([728 expect.objectContaining({729 type: "table",730 name: "products",731 note: "multiline note",732 indexes: expect.arrayContaining([733 expect.objectContaining({734 fields: expect.arrayContaining([735 expect.objectContaining({736 type: "field",737 field: "id",738 }),739 ]),740 settings: expect.arrayContaining([741 expect.objectContaining({742 type: "field_setting",743 value: "primary",744 }),745 ]),746 }),747 expect.objectContaining({748 fields: expect.arrayContaining([749 expect.objectContaining({750 type: "field",751 field: "country",752 }),753 expect.objectContaining({754 type: "field",755 field: "booking_date",756 }),757 ]),758 settings: expect.arrayContaining([759 expect.objectContaining({760 type: "field_setting",761 value: "unique",762 }),763 ]),764 }),765 expect.objectContaining({766 fields: expect.arrayContaining([767 expect.objectContaining({768 type: "field",769 field: "created_at",770 }),771 ]),772 settings: expect.arrayContaining([773 expect.objectContaining({774 type: "note",775 value: "Date",776 }),777 ]),778 }),779 expect.objectContaining({780 fields: expect.arrayContaining([781 expect.objectContaining({782 type: "field",783 field: "updated_at",784 }),785 ]),786 settings: expect.arrayContaining([787 expect.objectContaining({788 type: "note",789 value: "Update Date",790 }),791 ]),792 }),793 expect.objectContaining({794 fields: expect.arrayContaining([795 expect.objectContaining({796 type: "field",797 field: "updated_at",798 }),799 ]),800 settings: expect.arrayContaining([801 expect.objectContaining({802 type: "note",803 value: "Update Date",804 }),805 ]),806 }),807 expect.objectContaining({808 fields: expect.arrayContaining([809 expect.objectContaining({810 type: "field",811 field: "status",812 }),813 expect.objectContaining({814 type: "field",815 field: "merchant_id",816 }),817 expect.objectContaining({818 type: "field",819 field: "status",820 }),821 ]),822 settings: expect.arrayContaining([823 expect.objectContaining({824 type: "field_setting",825 value: "unique",826 }),827 expect.objectContaining({828 type: "note",829 value: "inventory status",830 }),831 expect.objectContaining({832 type: "index_name",833 value: "inventory status",834 }),835 ]),836 }),837 expect.objectContaining({838 fields: expect.arrayContaining([839 expect.objectContaining({840 type: "field",841 field: "arrive_date",842 }),843 ]),844 settings: expect.arrayContaining([845 expect.objectContaining({846 type: "index_type",847 value: "hash",848 }),849 ]),850 settings: expect.arrayContaining([851 expect.objectContaining({852 type: "note",853 value: "mail arrive",854 }),855 ]),856 }),857 ]),858 }),859 ])860 );861});862test("Long References Parsing", () => {863 const sqltext = `864 table users {865 id integer866 }867 table users_infos {868 id integer869 user_id integer870 }871 872 table roles {873 id integer874 user_id integer875 }876 ref infos {877 users.id < users_infos.user_id878 }879 ref {880 users.id < roles.user_id881 }882 `;883 const result = parse(sqltext);884 expect(result).toEqual(885 expect.arrayContaining([886 expect.objectContaining({ type: "table", name: "users" }),887 expect.objectContaining({888 type: "table",889 name: "users_infos",890 }),891 expect.objectContaining({892 type: "relationships",893 name: "infos",894 relationships: expect.arrayContaining([895 expect.objectContaining({896 type: "relationship",897 primary: expect.objectContaining({898 table: "users",899 column: "id",900 }),901 foreign: expect.objectContaining({902 table: "users_infos",903 column: "user_id",904 }),905 }),906 ]),907 }),908 expect.objectContaining({909 type: "relationships",910 relationships: expect.arrayContaining([911 expect.objectContaining({912 type: "relationship",913 primary: expect.objectContaining({914 table: "users",915 column: "id",916 }),917 foreign: expect.objectContaining({918 table: "roles",919 column: "user_id",920 }),921 }),922 ]),923 }),924 ])925 );926});927test("References Setting Parsing", () => {928 const sqltext = `929 table users {930 id integer931 }932 table users_infos {933 id integer934 user_id integer935 }936 937 table roles {938 id integer939 user_id integer940 }941 table stores {942 id integer943 user_id integer944 }945 ref infos 946 {947 users.id < users_infos.user_id [delete: set null, update: set default]948 }949 ref {950 users.id < roles.user_id [delete: cascade]951 }952 ref: users.id < stores.user_id [delete: no action]953 `;954 const result = parse(sqltext);955 expect(result).toEqual(956 expect.arrayContaining([957 expect.objectContaining({ type: "table", name: "users" }),958 expect.objectContaining({959 type: "table",960 name: "users_infos",961 }),962 expect.objectContaining({963 type: "relationships",964 name: "infos",965 relationships: expect.arrayContaining([966 expect.objectContaining({967 type: "relationship",968 settings: expect.arrayContaining([969 expect.objectContaining({970 type: "relationship_setting",971 setting: "delete",972 value: "set null",973 }),974 expect.objectContaining({975 type: "relationship_setting",976 setting: "update",977 value: "set default",978 }),979 ]),980 primary: expect.objectContaining({981 table: "users",982 column: "id",983 }),984 foreign: expect.objectContaining({985 table: "users_infos",986 column: "user_id",987 }),988 }),989 ]),990 }),991 expect.objectContaining({992 type: "relationships",993 relationships: expect.arrayContaining([994 expect.objectContaining({995 type: "relationship",996 settings: expect.arrayContaining([997 expect.objectContaining({998 type: "relationship_setting",999 setting: "delete",1000 value: "cascade",1001 }),1002 ]),1003 primary: expect.objectContaining({1004 table: "users",1005 column: "id",1006 }),1007 foreign: expect.objectContaining({1008 table: "roles",1009 column: "user_id",1010 }),1011 }),1012 ]),1013 }),1014 expect.objectContaining({1015 type: "relationship",1016 primary: expect.objectContaining({1017 table: "users",1018 column: "id",1019 }),1020 foreign: expect.objectContaining({1021 table: "stores",1022 column: "user_id",1023 }),1024 settings: expect.arrayContaining([1025 expect.objectContaining({1026 type: "relationship_setting",1027 setting: "delete",1028 value: "no action",1029 }),1030 ]),1031 }),1032 ])1033 );1034});1035test("Enum parsing", () => {1036 const sqltext = `1037 enum states 1038 {1039 open1040 closed1041 }1042 enum user_states {1043 active1044 inactive1045 pending [note: 'default state']1046 }1047 enum item_status { available1048 sold1049 }1050 table users {1051 id integer1052 }1053 table roles as R {1054 id integer1055 }1056 `;1057 const result = parse(sqltext);1058 expect(result).toEqual(1059 expect.arrayContaining([1060 expect.objectContaining({1061 type: "enum",1062 name: "states",1063 values: expect.arrayContaining([1064 expect.objectContaining({ value: "open" }),1065 expect.objectContaining({ value: "closed" }),1066 ]),1067 }),1068 expect.objectContaining({1069 type: "enum",1070 name: "user_states",1071 values: expect.arrayContaining([1072 expect.objectContaining({ value: "active" }),1073 expect.objectContaining({ value: "inactive" }),1074 expect.objectContaining({ value: "pending", note: "default state" }),1075 ]),1076 }),1077 expect.objectContaining({1078 type: "enum",1079 name: "item_status",1080 values: expect.arrayContaining([1081 expect.objectContaining({ value: "available" }),1082 expect.objectContaining({ value: "sold" }),1083 ]),1084 }),1085 expect.objectContaining({ type: "table", name: "roles", alias: "R" }),1086 expect.objectContaining({ type: "table", name: "users" }),1087 ])1088 );1089});1090test("Project Syntax Parsing", () => {1091 const sqltext = `1092 project main {1093 database_type: 'mysql'1094 note: "this is a note"1095 table users {1096 id integer1097 }1098 1099 table roles as R {1100 id integer1101 }1102 }1103 table categories {1104 id integer1105 }1106 table infos {1107 id integer1108 }1109 `;1110 const result = parse(sqltext);1111 expect(result).toEqual(1112 expect.arrayContaining([1113 expect.objectContaining({1114 type: "project",1115 name: "main",1116 elements: expect.arrayContaining([1117 expect.objectContaining({ type: "note", value: "this is a note" }),1118 expect.objectContaining({ type: "database", value: "mysql" }),1119 expect.objectContaining({ type: "table", name: "users" }),1120 expect.objectContaining({ type: "table", name: "roles", alias: "R" }),1121 ]),1122 }),1123 expect.objectContaining({ type: "table", name: "categories" }),1124 expect.objectContaining({ type: "table", name: "infos" }),1125 ])1126 );1127});1128test("Table Group Parsing", () => {1129 const sqltext = `1130 table users 1131 {1132 id integer1133 }1134 table roles as R {1135 id integer1136 }1137 table categories {1138 id integer1139 }1140 tablegroup main {1141 users1142 roles1143 }1144 `;1145 const result = parse(sqltext);1146 expect(result).toEqual(1147 expect.arrayContaining([1148 expect.objectContaining({1149 type: "table_group",1150 name: "main",1151 tables: expect.arrayContaining(["users", "roles"]),1152 }),1153 expect.objectContaining({ type: "table", name: "users" }),1154 expect.objectContaining({ type: "table", name: "roles", alias: "R" }),1155 expect.objectContaining({ type: "table", name: "categories" }),1156 ])1157 );...
fonts.test.js
Source:fonts.test.js
1import fonts from '../fonts';2describe('fonts', () => {3 it('should have the correct font-size', () => {4 expect(fonts.size.small()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:0.875rem')]));5 expect(fonts.size.regular()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:1rem;')]));6 expect(fonts.size.big()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:1.25rem;')]));7 expect(fonts.size.large()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:1.5rem;')]));8 expect(fonts.size.extraLarge()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:2rem;')]));9 });10 it('should have the correct font-weight', () => {11 expect(fonts.weights.light()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:light;')]));12 expect(fonts.weights.bold()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:bold;')]));13 expect(fonts.weights.normal()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:normal;')]));14 });15 it('should have the correct font-weight and font-size', () => {16 expect(fonts.style.heading()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:bold;')]));17 expect(fonts.style.heading()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:1.5rem;')]));18 expect(fonts.style.subheading()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:bold;')]));19 expect(fonts.style.subheading()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:1.25rem;')]));20 expect(fonts.style.standard()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:1rem;')]));21 expect(fonts.style.standard()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:normal;')]));22 expect(fonts.style.subText()).toEqual(expect.arrayContaining([expect.stringContaining('font-size:0.875rem;')]));23 expect(fonts.style.subText()).toEqual(expect.arrayContaining([expect.stringContaining('font-weight:normal;')]));24 });...
Using AI Code Generation
1const { Matchers } = require('@pact-foundation/pact');2const { somethingLike } = Matchers;3const example = {4 id: somethingLike(1),5 name: somethingLike('John Doe'),6};7const example2 = {8 id: somethingLike(2),9 name: somethingLike('Jane Doe'),10};11const example3 = {12 id: somethingLike(3),13 name: somethingLike('Jim Doe'),14};15const example4 = {16 id: somethingLike(4),17 name: somethingLike('Jill Doe'),18};19const example5 = {20 id: somethingLike(5),21 name: somethingLike('Jack Doe'),22};23const example6 = {24 id: somethingLike(6),25 name: somethingLike('Jenny Doe'),26};27const example7 = {28 id: somethingLike(7),29 name: somethingLike('John Doe'),30};31const example8 = {32 id: somethingLike(8),33 name: somethingLike('Jane Doe'),34};35const example9 = {36 id: somethingLike(9),37 name: somethingLike('Jim Doe'),38};39const example10 = {40 id: somethingLike(10),41 name: somethingLike('Jill Doe'),42};43const example11 = {44 id: somethingLike(11),45 name: somethingLike('Jack Doe'),46};47const example12 = {48 id: somethingLike(12),49 name: somethingLike('Jenny Doe'),50};51const example13 = {52 id: somethingLike(13),53 name: somethingLike('John Doe'),54};55const example14 = {56 id: somethingLike(14),57 name: somethingLike('Jane Doe'),58};59const example15 = {60 id: somethingLike(15),61 name: somethingLike('Jim Doe'),62};63const example16 = {64 id: somethingLike(16),65 name: somethingLike('Jill Doe'),66};67const example17 = {68 id: somethingLike(17),69 name: somethingLike('Jack Doe'),70};71const example18 = {72 id: somethingLike(18),73 name: somethingLike('Jenny Doe'),74};75const example19 = {76 id: somethingLike(19),77 name: somethingLike('John Doe'),78};79const example20 = {80 id: somethingLike(20),81 name: somethingLike('Jane Doe'),82};83const example21 = {84 id: somethingLike(
Using AI Code Generation
1const { Matchers } = require('@pact-foundation/pact');2const { arrayContaining, like } = Matchers;3const body = {4 "address": {5 },6 "hobbies": arrayContaining(["football", "cricket"])7};8module.exports = body;9const { Matchers } = require('@pact-foundation/pact');10const { like, eachLike } = Matchers;11const { somethingLike } = Matchers;12const { like: like2, eachLike: eachLike2 } = Matchers;13const { arrayContaining } = Matchers;14const { arrayContaining: arrayContaining2 } = Matchers;15const { arrayContaining: arrayContaining3, like: like3 } = Matchers;16const { like: like4, arrayContaining: arrayContaining4 } = Matchers;17const { like: like5, arrayContaining: arrayContaining5, eachLike: eachLike5 } = Matchers;18const { eachLike: eachLike6, like: like6, arrayContaining: arrayContaining6 } = Matchers;19const { eachLike: eachLike7, like: like7, arrayContaining: arrayContaining7, somethingLike: somethingLike7 } = Matchers;20const { eachLike: eachLike8, like: like8, arrayContaining: arrayContaining8, somethingLike: somethingLike8, term: term8 } = Matchers;21const { eachLike: eachLike9, like: like9, arrayContaining: arrayContaining9, somethingLike: somethingLike9, term: term9, date: date9 } = Matchers;22const { eachLike: eachLike10, like: like10, arrayContaining: arrayContaining10, somethingLike: somethingLike10, term: term10, date: date10, integer: integer10 } = Matchers;23const { eachLike: eachLike11, like: like11, arrayContaining: arrayContaining11, somethingLike: somethingLike11, term: term11, date: date11, integer: integer11, boolean: boolean11 } = Matchers;24const { eachLike: eachLike12, like: like12, arrayContaining: arrayContaining12, somethingLike
Using AI Code Generation
1const { Matchers } = require('@pact-foundation/pact');2const { somethingLike, like, term, eachLike, arrayContaining } = Matchers;3const expectedResponse = {4 "cars": arrayContaining([5 {6 "models": arrayContaining([7 }, {8 "models": arrayContaining([9 }, {10 "models": arrayContaining([11 }12};13module.exports = expectedResponse;14const { Matchers } = require('@pact-foundation/pact');15const { somethingLike, like, term, eachLike, arrayContaining } = Matchers;16const expectedResponse = {17 "cars": arrayContaining([18 {19 "models": arrayContaining([20 }, {21 "models": arrayContaining([22 }, {23 "models": arrayContaining([24 }25};26module.exports = expectedResponse;27const { Matchers } = require('@pact-foundation/pact');28const { somethingLike, like, term, eachLike, arrayContaining } = Matchers;29const expectedResponse = {30 "cars": arrayContaining([31 {32 "models": arrayContaining([33 }, {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!