Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Test] Add two ProjectTests (ComplexTest01, ImportTest)
- Loading branch information
1 parent
5937bd8
commit ece6a9e
Showing
9 changed files
with
70 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ tmp/ | |
.secret_token | ||
*.tsbuildinfo | ||
build/*.js | ||
packages/bundle.json | ||
packages/bundle.json | ||
dist/ |
8 changes: 8 additions & 0 deletions
8
test/testSuites/ProjectTest/ComplexTest01/src/ComplexTest01.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { GroupManager } from "./Model/GroupManager"; | ||
import { StringUtil } from "./Utils/StringUtil"; | ||
|
||
const gm = new GroupManager(); | ||
gm.generateANewGroup(); | ||
gm.importGroup('{"name":"importedGroup", "users":[{"name":"imported user1"}]}'); | ||
const groupNames = StringUtil.concatTwoStrings(gm.groups[0].name, gm.groups[1].name); | ||
console.log(`Group names: ${groupNames}`); |
6 changes: 6 additions & 0 deletions
6
test/testSuites/ProjectTest/ComplexTest01/src/Model/Db/Group.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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { User } from "./User"; | ||
|
||
export class Group { | ||
public name: string; | ||
public users: User[]; | ||
} |
3 changes: 3 additions & 0 deletions
3
test/testSuites/ProjectTest/ComplexTest01/src/Model/Db/User.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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export class User { | ||
constructor(public name: string) { } | ||
} |
22 changes: 22 additions & 0 deletions
22
test/testSuites/ProjectTest/ComplexTest01/src/Model/GroupManager.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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { OneJson } from "@one/One.Json-v0.1"; | ||
|
||
import { Group } from "./Db/Group"; | ||
import { User } from "./Db/User"; | ||
import { StringUtil } from "../Utils/StringUtil"; | ||
|
||
export class GroupManager { | ||
public groups: Group[] = []; | ||
|
||
generateANewGroup() { | ||
const g = new Group(); | ||
g.name = "MyGroup"; | ||
g.users = [new User("user1"), new User("user2")]; | ||
this.groups.push(g); | ||
} | ||
|
||
importGroup(exportedJson: string) { | ||
const g = <Group> OneJson.deserialize(exportedJson); | ||
g.name = StringUtil.ucFirst(g.name); | ||
this.groups.push(g); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
test/testSuites/ProjectTest/ComplexTest01/src/Utils/StringUtil.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export class StringUtil { | ||
static ucFirst(str: string) { return str[0].toUpperCase() + str.substr(1); } | ||
static concatTwoStrings(str1: string, str2: string) { return str1 + ", " + str2; } | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"target": "es2017", | ||
"module": "CommonJS", | ||
"outDir": "dist", | ||
"moduleResolution": "node", | ||
"paths": { "@one/*": ["../../../../packages/interfaces/*"]} | ||
}, | ||
"include": ["src/**/*.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { OneJson } from "One.Json-v0.1"; | ||
|
||
const value = OneJson.parse("5"); | ||
console.log(`isNumber: ${value.isNumber}`); |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "./", | ||
"target": "es2017", | ||
"outDir": "dist", | ||
"moduleResolution": "node", | ||
"paths": { "*": ["../../../../packages/interfaces/*" ]} | ||
}, | ||
"include": ["src/**/*.ts"], | ||
} |