|
| 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 | + // eslint-disable-next-line @typescript-eslint/no-unused-expressions |
| 23 | + expect(stub).to.not.have.been.called; |
| 24 | + }); |
| 25 | + }); |
| 26 | + |
| 27 | + it("invalid file results in error", () => { |
| 28 | + const fileName = "example-style.json"; |
| 29 | + |
| 30 | + const stub = cy.stub(); |
| 31 | + cy.on('window:alert', stub); |
| 32 | + |
| 33 | + get |
| 34 | + .bySelector("file", "type") |
| 35 | + .selectFile(`cypress/fixtures/${fileName}`, { force: true }); |
| 36 | + when.wait(200); |
| 37 | + cy.then(() => { |
| 38 | + // eslint-disable-next-line @typescript-eslint/no-unused-expressions |
| 39 | + expect(stub).to.be.called; |
| 40 | + expect(stub.getCall(0).args[0]).to.contain('File type is not supported'); |
| 41 | + }); |
| 42 | + }) |
| 43 | + }); |
| 44 | +}); |
0 commit comments