fix: 🐛 silently drop trailing slashes from origin input

This commit is contained in:
Randall Morey committed 2021-04-08 13:45:19 -04:00
1 parent 80cffeb48b
commit 0d8508cd4e
4 files changed
+21 -23

No files matched your search

@@ -24,4 +24,15 @@ module('Unit | Service | origin', function (hooks) {
assert.equal(service.adapter.host, window.location.origin);
});
});
test('drops trailing slashes from origin on setOrigin', async function (assert) {
assert.expect(4);
sinon.stub(ipcService, 'invoke');
await service.setOrigin(`${window.location.origin}/`);
assert.equal(service.rendererOrigin, window.location.origin);
assert.equal(service.adapter.host, window.location.origin);
await service.setOrigin(`${window.location.origin}//////`);
assert.equal(service.rendererOrigin, window.location.origin);
assert.equal(service.adapter.host, window.location.origin);
});
});