|
1 | | -/* eslint-disable max-lines-per-function */ |
2 | 1 | /* eslint-disable max-statements */ |
3 | 2 |
|
4 | 3 | import("reflect-metadata"); // Polyfill |
5 | 4 | import {assert} from "chai"; |
6 | 5 | import {describe, it} from "node:test"; |
7 | | - |
8 | | -// Import type {Friend as IFriend} from "./models/User"; |
| 6 | +import type {Friend as IFriend} from "./models/User"; |
9 | 7 |
|
10 | 8 |
|
11 | 9 | describe("FormData convertation", () => { |
@@ -41,22 +39,17 @@ describe("FormData convertation", () => { |
41 | 39 | assert.strictEqual(user.greeting, formData.get("greeting"), "greeting is not equal"); |
42 | 40 | assert.strictEqual(user.favoriteFruit, formData.get("favoriteFruit"), "favoriteFruit is not equal"); |
43 | 41 |
|
44 | | - /* |
45 | | - * Nodejs version of FormData don't support arrays of objects, but C# and browser version of FormData support him. |
46 | | - * Because test run under nodejs env, this next part disabled. Check this code in future versions of nodejs. |
47 | | - * |
48 | | - * user.friends.forEach((friend: IFriend, index: number) => { |
49 | | - * assert.strictEqual( |
50 | | - * String(friend.id), |
51 | | - * formData.get(`friends[${index.toString()}].id`), |
52 | | - * `friend ${String(index)} id is not equal` |
53 | | - * ); |
54 | | - * assert.strictEqual( |
55 | | - * friend.name, |
56 | | - * formData.get(`friends[${index.toString()}].name`), |
57 | | - * `friend ${String(index)} name is not equal` |
58 | | - * ); |
59 | | - * }); |
60 | | - */ |
| 42 | + user.friends.forEach((friend: IFriend, index: number) => { |
| 43 | + assert.strictEqual( |
| 44 | + String(friend.id), |
| 45 | + formData.get(`friends[${index.toString()}].id`), |
| 46 | + `friend ${String(index)} id is not equal` |
| 47 | + ); |
| 48 | + assert.strictEqual( |
| 49 | + friend.name, |
| 50 | + formData.get(`friends[${index.toString()}].name`), |
| 51 | + `friend ${String(index)} name is not equal` |
| 52 | + ); |
| 53 | + }); |
61 | 54 | }); |
62 | 55 | }); |
0 commit comments