Skip to content

Commit

Permalink
Browser: Refactored tests of Fetch
Browse files Browse the repository at this point in the history
Made unit tests independent of loaded HTML page.
Moved browser dependent tests to Browser project.
Updated npm packages.
  • Loading branch information
FunctionPoint committed Jun 22, 2024
1 parent 73c0e8e commit e5131bd
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 55 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
CLASS TestFetch EXTENDS Test MODULE TestBrowser CLASSVARS '' VARS ''

test
Fetch text: 'Test/MyObject.json'
Fetch text: 'MyObject.json'
then: [ :string | self onFetchFile: string ]
catch: [ :error | error throw ].

Fetch object: 'Test/MyObject.json'
Fetch object: 'MyObject.json'
then: [ :object | self onFetchObject: object ]
catch: [ :error | error throw ].

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
CLASS TestRequest EXTENDS Test MODULE TestCore CLASSVARS '' VARS ''
"Also tests Response, Headers."
CLASS TestRequest EXTENDS Test MODULE TestBrowserApp CLASSVARS '' VARS ''

testRequest
| request |

request := Request url: 'Test/MyObject.json'.
request := Request url: 'MyObject.json'.

self assert: [ request class = Request ].
self assert: [ request bodyUsed not ].
Expand Down
File renamed without changes.
6 changes: 0 additions & 6 deletions Browser/web/Test/Import.css

This file was deleted.

3 changes: 0 additions & 3 deletions Browser/web/Test/MyComponent.css

This file was deleted.

4 changes: 0 additions & 4 deletions Browser/web/Test/MyComponent.html

This file was deleted.

14 changes: 7 additions & 7 deletions Compiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Compiler/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.2",
"@types/node": "^20.14.8",
"source-map": "^0.7.4"
}
}
28 changes: 14 additions & 14 deletions Examples/Shop/Server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Examples/Shop/Server/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.2",
"@types/node": "^20.14.8",
"express": "^4.19.2",
"express-session": "^1.18.0",
"http-terminator": "^3.2.0",
"mariadb": "^3.3.1",
"mysql2": "^3.10.0",
"mysql2": "^3.10.1",
"node-fetch": "^3.3.2",
"pg": "^8.12.0"
}
Expand Down
16 changes: 8 additions & 8 deletions Node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Node/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"type": "module",
"dependencies": {
"@types/node": "^20.14.2",
"@types/node": "^20.14.8",
"express": "^4.19.2",
"express-session": "^1.18.0",
"http-terminator": "^3.2.0",
"mariadb": "^3.3.1",
"mysql2": "^3.10.0",
"mysql2": "^3.10.1",
"node-fetch": "^3.3.2",
"pg": "^8.12.0"
}
Expand Down
6 changes: 3 additions & 3 deletions Smalltalk/Browser/Fetch/Test/TestRequestOptions.st
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CLASS TestRequestOptions EXTENDS Test MODULE TestCore CLASSVARS '' VARS ''
CLASS TestRequestOptions EXTENDS Test MODULE TestBrowser CLASSVARS '' VARS ''

test
| options request |
Expand Down Expand Up @@ -45,8 +45,8 @@ test
options priority: 'high'.
self assert: [ options priority = 'high' ].

request := Request url: 'Test/MyObject.json' options: options.
self assert: [ request url includes: 'Test/MyObject.json' ].
request := Request url: 'Missing.json' options: options.
self assert: [ request url includes: 'Missing.json' ].

self assert: [ request bodyUsed not ].
self assert: [ request cache = options cache ].
Expand Down

0 comments on commit e5131bd

Please sign in to comment.