Skip to content

Commit 73e9a9c

Browse files
authored
feat: Add AU Endpoint (#56)
1 parent a069c10 commit 73e9a9c

2 files changed

Lines changed: 83 additions & 1 deletion

File tree

src/BrazeKit-dev.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ var clusterMapping = {
3232
'04': 'sdk.iad-04.braze.com',
3333
'05': 'sdk.iad-05.braze.com',
3434
'06': 'sdk.iad-06.braze.com',
35+
'07': 'sdk.iad-07.braze.com',
3536
'08': 'sdk.iad-08.braze.com',
3637
EU: 'sdk.fra-01.braze.eu',
3738
EU02: 'sdk.fra-02.braze.eu',
39+
AU: 'sdk.au-01.braze.com',
3840
};
3941

4042
var constructor = function () {

test/tests.js

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ describe('Braze Forwarder', function() {
10891089
// Braze's API expects a year from us, this test will break every year,
10901090
// since setting the age = 10 in 2021 will mean the user is born in 2011,
10911091
// but setting it in 2023 means the year is 2013.
1092-
window.braze.getUser().yearOfBirth.should.equal(2014);
1092+
window.braze.getUser().yearOfBirth.should.equal(2015);
10931093
window.braze.getUser().dayOfBirth.should.equal(1);
10941094
window.braze.getUser().monthOfBirth.should.equal(1);
10951095
window.braze.getUser().phoneSet.should.equal('1234567890');
@@ -1364,6 +1364,32 @@ user.getUserIdentities is not a function,\n`;
13641364
window.braze.should.have.property('baseUrl', 'sdk.fra-01.braze.eu');
13651365
});
13661366

1367+
it('should use the AU data center when dataCenterLocation is set to AU and no host is passed', function() {
1368+
reportService.reset();
1369+
window.braze = new MockBraze();
1370+
mParticle.forwarder.init(
1371+
{
1372+
apiKey: '123456',
1373+
dataCenterLocation: 'AU',
1374+
},
1375+
reportService.cb,
1376+
true,
1377+
null,
1378+
{
1379+
gender: 'm',
1380+
},
1381+
[
1382+
{
1383+
Identity: 'testUser',
1384+
Type: IdentityType.CustomerId,
1385+
},
1386+
],
1387+
'1.1',
1388+
'My App'
1389+
);
1390+
window.braze.baseUrl.should.equal('sdk.au-01.braze.com');
1391+
});
1392+
13671393
it('should use the 01 clusterMapping url when 01 number is passed to cluster', function() {
13681394
reportService.reset();
13691395
window.braze = new MockBraze();
@@ -1475,6 +1501,33 @@ user.getUserIdentities is not a function,\n`;
14751501
window.braze.baseUrl.should.equal('sdk.iad-04.braze.com');
14761502
});
14771503

1504+
it('should use the 05 clusterMapping url when 05 number is passed to cluster', function() {
1505+
reportService.reset();
1506+
window.braze = new MockBraze();
1507+
mParticle.forwarder.init(
1508+
{
1509+
apiKey: '123456',
1510+
cluster: '05',
1511+
},
1512+
reportService.cb,
1513+
true,
1514+
null,
1515+
{
1516+
gender: 'm',
1517+
},
1518+
[
1519+
{
1520+
Identity: 'testUser',
1521+
Type: IdentityType.CustomerId,
1522+
},
1523+
],
1524+
'1.1',
1525+
'My App'
1526+
);
1527+
1528+
window.braze.baseUrl.should.equal('sdk.iad-05.braze.com');
1529+
});
1530+
14781531
it('should use the 06 clusterMapping url when 06 number is passed to cluster', function() {
14791532
reportService.reset();
14801533
window.braze = new MockBraze();
@@ -1502,6 +1555,33 @@ user.getUserIdentities is not a function,\n`;
15021555
window.braze.baseUrl.should.equal('sdk.iad-06.braze.com');
15031556
});
15041557

1558+
it('should use the 07 clusterMapping url when 07 number is passed to cluster', function() {
1559+
reportService.reset();
1560+
window.braze = new MockBraze();
1561+
mParticle.forwarder.init(
1562+
{
1563+
apiKey: '123456',
1564+
cluster: '07',
1565+
},
1566+
reportService.cb,
1567+
true,
1568+
null,
1569+
{
1570+
gender: 'm',
1571+
},
1572+
[
1573+
{
1574+
Identity: 'testUser',
1575+
Type: IdentityType.CustomerId,
1576+
},
1577+
],
1578+
'1.1',
1579+
'My App'
1580+
);
1581+
1582+
window.braze.baseUrl.should.equal('sdk.iad-07.braze.com');
1583+
});
1584+
15051585
it('should use the 08 clusterMapping url when 08 number is passed to cluster', function() {
15061586
reportService.reset();
15071587
window.braze = new MockBraze();

0 commit comments

Comments
 (0)