File tree Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Expand file tree Collapse file tree 2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ import { MaputnikDriver } from "./maputnik-driver" ;
2+
3+ describe ( "local file" , ( ) => {
4+ const { when, get } = new MaputnikDriver ( ) ;
5+
6+ beforeEach ( ( ) => {
7+ when . setStyle ( "" ) ;
8+ } ) ;
9+
10+ describe ( "PMTiles" , ( ) => {
11+ it ( "valid file loads without error" , ( ) => {
12+ const fileName = "polygon-z0.pmtiles" ; // a small polygon located at Null Island
13+
14+ const stub = cy . stub ( ) ;
15+ cy . on ( 'window:alert' , stub ) ;
16+
17+ get
18+ . bySelector ( "file" , "type" )
19+ . selectFile ( `cypress/fixtures/${ fileName } ` , { force : true } ) ;
20+ when . wait ( 200 ) ;
21+ cy . then ( ( ) => {
22+ expect ( stub ) . to . not . have . been . called ;
23+ } ) ;
24+ } ) ;
25+
26+ it ( "invalid file results in error" , ( ) => {
27+ const fileName = "example-style.json" ;
28+
29+ const stub = cy . stub ( ) ;
30+ cy . on ( 'window:alert' , stub ) ;
31+
32+ get
33+ . bySelector ( "file" , "type" )
34+ . selectFile ( `cypress/fixtures/${ fileName } ` , { force : true } ) ;
35+ when . wait ( 200 ) ;
36+ cy . then ( ( ) => {
37+ expect ( stub ) . to . be . called ;
38+ expect ( stub . getCall ( 0 ) . args [ 0 ] ) . to . contain ( 'File type must be one of application/octet-stream, .pmtiles' ) ;
39+ } ) ;
40+ } )
41+ } ) ;
42+ } ) ;
You can’t perform that action at this time.
0 commit comments