-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into 1.5.x
# Conflicts: # src/SDK/Language/PHP.php
- Loading branch information
Showing
16 changed files
with
610 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
export class {{ spec.title | caseUcfirst}}Exception { | ||
message: String; | ||
code: Number; | ||
message: string; | ||
code: number; | ||
response: any; | ||
type: String; | ||
type: string; | ||
|
||
constructor(message: String, code: Number = 0, type: String = "", response: any = "") { | ||
constructor(message: string, code: number = 0, type: string = "", response: any = "") { | ||
this.message = message; | ||
this.code = code; | ||
this.type = type; | ||
this.response = response; | ||
} | ||
|
||
public toString(): String { | ||
public toString(): string { | ||
return `${this.message} - ${this.code} - ${this.type} - ${JSON.stringify(this.response)}`; | ||
} | ||
} | ||
} |
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 {assertEquals} from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import {describe, it as test} from "https://deno.land/[email protected]/testing/bdd.ts"; | ||
import {ID} from "../src/id.ts"; | ||
|
||
describe("ID", () => { | ||
test('unique', () => assertEquals(ID.unique(), 'unique()')); | ||
test('custom', () => assertEquals(ID.custom('custom'), 'custom')); | ||
}); |
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,12 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { describe, it as test } from "https://deno.land/[email protected]/testing/bdd.ts"; | ||
import {Permission} from "../src/permission.ts"; | ||
import {Role} from "../src/role.ts"; | ||
|
||
describe('Permission', () => { | ||
test('read', () => assertEquals(Permission.read(Role.any()), 'read("any")')); | ||
test('write', () => assertEquals(Permission.write(Role.any()), 'write("any")')); | ||
test('create', () => assertEquals(Permission.create(Role.any()), 'create("any")')); | ||
test('update', () => assertEquals(Permission.update(Role.any()), 'update("any")')); | ||
test('delete', () => assertEquals(Permission.delete(Role.any()), 'delete("any")')); | ||
}) |
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,175 @@ | ||
import {describe, it as test} from "https://deno.land/[email protected]/testing/bdd.ts"; | ||
import {assertEquals} from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import {Query, QueryTypes} from "../src/query.ts"; | ||
|
||
type BasicFilterQueryTest = { | ||
description: string; | ||
value: QueryTypes; | ||
expectedValues: string; | ||
} | ||
|
||
const tests: BasicFilterQueryTest[] = [ | ||
{ | ||
description: 'with a string', | ||
value: 's', | ||
expectedValues: '["s"]' | ||
}, | ||
{ | ||
description: 'with a integer', | ||
value: 1, | ||
expectedValues: '[1]' | ||
}, | ||
{ | ||
description: 'with a double', | ||
value: 1.2, | ||
expectedValues: '[1.2]' | ||
}, | ||
{ | ||
description: 'with a whole number double', | ||
value: 1.0, | ||
expectedValues: '[1]' | ||
}, | ||
{ | ||
description: 'with a bool', | ||
value: false, | ||
expectedValues: '[false]' | ||
}, | ||
{ | ||
description: 'with a list', | ||
value: ['a', 'b', 'c'], | ||
expectedValues: '["a","b","c"]' | ||
} | ||
]; | ||
|
||
describe('Query', () => { | ||
describe('basic filter equal', () => { | ||
for (const t of tests) { | ||
test(t.description, () => | ||
assertEquals( | ||
Query.equal("attr", t.value), | ||
`equal("attr", ${t.expectedValues})`, | ||
) | ||
) | ||
} | ||
}) | ||
|
||
describe('basic filter notEqual', () => { | ||
for (const t of tests) { | ||
test(t.description, () => | ||
assertEquals( | ||
Query.notEqual("attr", t.value), | ||
`notEqual("attr", ${t.expectedValues})`, | ||
) | ||
) | ||
} | ||
}); | ||
|
||
describe('basic filter lessThan', () => { | ||
for (const t of tests) { | ||
test(t.description, () => | ||
assertEquals( | ||
Query.lessThan("attr", t.value), | ||
`lessThan("attr", ${t.expectedValues})`, | ||
) | ||
) | ||
} | ||
}); | ||
|
||
describe('basic filter lessThanEqual', () => { | ||
for (const t of tests) { | ||
test(t.description, () => | ||
assertEquals( | ||
Query.lessThanEqual("attr", t.value), | ||
`lessThanEqual("attr", ${t.expectedValues})`, | ||
) | ||
) | ||
} | ||
}); | ||
|
||
describe('basic filter greaterThan', () => { | ||
for (const t of tests) { | ||
test(t.description, () => | ||
assertEquals( | ||
Query.greaterThan("attr", t.value), | ||
`greaterThan("attr", ${t.expectedValues})`, | ||
) | ||
) | ||
} | ||
}); | ||
|
||
describe('basic filter greaterThanEqual', () => { | ||
for (const t of tests) { | ||
test(t.description, () => | ||
assertEquals( | ||
Query.greaterThanEqual("attr", t.value), | ||
`greaterThanEqual("attr", ${t.expectedValues})`, | ||
) | ||
) | ||
} | ||
}); | ||
|
||
test('search', () => assertEquals( | ||
Query.search('attr', 'keyword1 keyword2'), | ||
'search("attr", ["keyword1 keyword2"])', | ||
)); | ||
|
||
test('isNull', () => assertEquals( | ||
Query.isNull('attr'), | ||
'isNull("attr")', | ||
)); | ||
|
||
test('isNotNull', () => assertEquals( | ||
Query.isNotNull('attr'), | ||
'isNotNull("attr")', | ||
)); | ||
|
||
describe('between', () => { | ||
test('with integers', () => assertEquals( | ||
Query.between('attr', 1, 2), | ||
'between("attr", 1, 2)' | ||
)); | ||
test('with doubles', () => assertEquals( | ||
Query.between('attr', 1.2, 2.2), | ||
'between("attr", 1.2, 2.2)' | ||
)); | ||
test('with strings', () => assertEquals( | ||
Query.between('attr', "a", "z"), | ||
'between("attr", "a", "z")' | ||
)); | ||
}); | ||
|
||
test('select', () => assertEquals( | ||
Query.select(['attr1', 'attr2']), | ||
'select(["attr1","attr2"])', | ||
)); | ||
|
||
test('orderAsc', () => assertEquals( | ||
Query.orderAsc('attr'), | ||
'orderAsc("attr")', | ||
)); | ||
|
||
test('orderDesc', () => assertEquals( | ||
Query.orderDesc('attr'), | ||
'orderDesc("attr")', | ||
)); | ||
|
||
test('cursorBefore', () => assertEquals( | ||
Query.cursorBefore('attr'), | ||
'cursorBefore("attr")', | ||
)); | ||
|
||
test('cursorAfter', () => assertEquals( | ||
Query.cursorAfter('attr'), | ||
'cursorAfter("attr")', | ||
)); | ||
|
||
test('limit', () => assertEquals( | ||
Query.limit(1), | ||
'limit(1)' | ||
)); | ||
|
||
test('offset', () => assertEquals( | ||
Query.offset(1), | ||
'offset(1)' | ||
)); | ||
}) |
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,16 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { describe, it as test } from "https://deno.land/[email protected]/testing/bdd.ts"; | ||
import {Role} from "../src/role.ts"; | ||
|
||
describe('Role', () => { | ||
test('any', () => assertEquals(Role.any(), 'any')); | ||
test('user without status', () => assertEquals(Role.user('custom'), 'user:custom')); | ||
test('user with status', () => assertEquals(Role.user('custom', 'verified'), 'user:custom/verified')); | ||
test('users without status', () => assertEquals(Role.users(), 'users')); | ||
test('users with status', () => assertEquals(Role.users('verified'), 'users/verified')); | ||
test('guests', () => assertEquals(Role.guests(), 'guests')); | ||
test('team without role', () => assertEquals(Role.team('custom'), 'team:custom')) | ||
test('team with role', () => assertEquals(Role.team('custom', 'owner'), 'team:custom/owner')) | ||
test('member', () => assertEquals(Role.member('custom'), 'member:custom')) | ||
test('label', () => assertEquals(Role.label('admin'), 'label:admin')) | ||
}) |
Oops, something went wrong.