1
0
Fork 0
mirror of synced 2024-09-30 17:26:48 +13:00

feat: improve functions tests

This commit is contained in:
Christy Jacob 2022-02-19 19:14:35 +04:00
parent cc8fac0297
commit 7a6d8502de
2 changed files with 5 additions and 1 deletions

View file

@ -870,7 +870,9 @@ class FunctionsCustomServerTest extends Scope
'functionId' => 'unique()', 'functionId' => 'unique()',
'name' => 'Test '.$name, 'name' => 'Test '.$name,
'runtime' => $name, 'runtime' => $name,
'vars' => [], 'vars' => [
'CUSTOM_VARIABLE' => 'variable',
],
'events' => [], 'events' => [],
'schedule' => '', 'schedule' => '',
'timeout' => $timeout, 'timeout' => $timeout,
@ -934,6 +936,7 @@ class FunctionsCustomServerTest extends Scope
$this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT']); $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT']);
$this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT_DATA']); $this->assertEquals('', $output['APPWRITE_FUNCTION_EVENT_DATA']);
$this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']); $this->assertEquals('foobar', $output['APPWRITE_FUNCTION_DATA']);
$this->assertEquals('variable', $output['CUSTOM_VARIABLE']);
$this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']); $this->assertEquals('', $output['APPWRITE_FUNCTION_USER_ID']);
$this->assertEmpty($output['APPWRITE_FUNCTION_JWT']); $this->assertEmpty($output['APPWRITE_FUNCTION_JWT']);
$this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']); $this->assertEquals($this->getProject()['$id'], $output['APPWRITE_FUNCTION_PROJECT_ID']);

View file

@ -24,5 +24,6 @@ module.exports = async (req, res) => {
'APPWRITE_FUNCTION_USER_ID' : req.env.APPWRITE_FUNCTION_USER_ID, 'APPWRITE_FUNCTION_USER_ID' : req.env.APPWRITE_FUNCTION_USER_ID,
'APPWRITE_FUNCTION_JWT' : req.env.APPWRITE_FUNCTION_JWT, 'APPWRITE_FUNCTION_JWT' : req.env.APPWRITE_FUNCTION_JWT,
'APPWRITE_FUNCTION_PROJECT_ID' : req.env.APPWRITE_FUNCTION_PROJECT_ID, 'APPWRITE_FUNCTION_PROJECT_ID' : req.env.APPWRITE_FUNCTION_PROJECT_ID,
'CUSTOM_VARIABLE' : req.env.CUSTOM_VARIABLE
}); });
} }