refactor: offline roles (#2169)
This commit is contained in:
@@ -60,8 +60,8 @@ describe('features', () => {
|
||||
|
||||
describe('new user roles received on api response meta', () => {
|
||||
it('should save roles and features', async () => {
|
||||
expect(application.featuresService.roles).to.have.lengthOf(1)
|
||||
expect(application.featuresService.roles[0]).to.equal('CORE_USER')
|
||||
expect(application.featuresService.onlineRoles).to.have.lengthOf(1)
|
||||
expect(application.featuresService.onlineRoles[0]).to.equal('CORE_USER')
|
||||
|
||||
expect(application.featuresService.features).to.have.lengthOf(3)
|
||||
expect(application.featuresService.features[0]).to.containSubset(midnightThemeFeature)
|
||||
@@ -115,7 +115,7 @@ describe('features', () => {
|
||||
// Wipe items from initial sync
|
||||
await application.itemManager.removeAllItemsFromMemory()
|
||||
// Wipe roles from initial sync
|
||||
await application.featuresService.setRoles([])
|
||||
await application.featuresService.setOnlineRoles([])
|
||||
// Create pre-existing item for theme without all the info
|
||||
await application.itemManager.createItem(
|
||||
ContentType.Theme,
|
||||
@@ -165,7 +165,7 @@ describe('features', () => {
|
||||
.find((theme) => theme.identifier === midnightThemeFeature.identifier)
|
||||
|
||||
// Wipe roles from initial sync
|
||||
await application.featuresService.setRoles([])
|
||||
await application.featuresService.setOnlineRoles([])
|
||||
|
||||
// Call sync intentionally to get roles again in meta
|
||||
await application.sync.sync()
|
||||
@@ -184,7 +184,7 @@ describe('features', () => {
|
||||
})
|
||||
|
||||
it('should provide feature', async () => {
|
||||
const feature = application.features.getUserFeature(FeatureIdentifier.PlusEditor)
|
||||
const feature = application.features.getFeatureThatOriginallyCameFromServer(FeatureIdentifier.PlusEditor)
|
||||
expect(feature).to.containSubset(plusEditorFeature)
|
||||
})
|
||||
|
||||
|
||||
@@ -645,6 +645,8 @@ describe('keys', function () {
|
||||
|
||||
expect(Object.keys(clientBUndecryptables).length).to.equal(1)
|
||||
expect(Object.keys(clientAUndecryptables).length).to.equal(0)
|
||||
|
||||
await contextB.deinit()
|
||||
})
|
||||
|
||||
describe('changing password on 003 client while signed into 004 client should', function () {
|
||||
|
||||
@@ -40,7 +40,7 @@ describe('online conflict handling', function () {
|
||||
|
||||
afterEach(async function () {
|
||||
if (!this.application.dealloced) {
|
||||
await Factory.safeDeinit(this.application)
|
||||
await this.context.deinit()
|
||||
}
|
||||
localStorage.clear()
|
||||
})
|
||||
@@ -950,6 +950,7 @@ describe('online conflict handling', function () {
|
||||
expect(contextA.findNoteByTitle('title-B').payload.updated_at_timestamp).to.equal(noteBExpectedTimestamp)
|
||||
|
||||
await this.sharedFinalAssertions()
|
||||
await contextB.deinit()
|
||||
}).timeout(20000)
|
||||
|
||||
it('editing original note many times after conflict on other client should only result in 2 cumulative notes', async function () {
|
||||
@@ -979,5 +980,6 @@ describe('online conflict handling', function () {
|
||||
expect(contextB.noteCount).to.equal(2)
|
||||
|
||||
await this.sharedFinalAssertions()
|
||||
await contextB.deinit()
|
||||
}).timeout(20000)
|
||||
})
|
||||
|
||||
@@ -1052,5 +1052,7 @@ describe('online syncing', function () {
|
||||
await contextB.sync()
|
||||
|
||||
expect(contextB.application.items.allCountableNotesCount()).to.equal(0)
|
||||
|
||||
await contextB.deinit()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user