-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(echo): sync version with package json (#5625)
* feat(echo): sync version with package json * refactor(package.json): update file paths in exports * test(api): add echo health check e2e tests * style: Fix extra space in test description * test(content-templates): update assertion syntax --------- Co-authored-by: Richard Fontein <32132657+rifont@users.noreply.github.com>
- Loading branch information
1 parent
ec276f5
commit 4fffa6d
Showing
7 changed files
with
81 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import axios from 'axios'; | ||
import { expect } from 'chai'; | ||
import { UserSession, SubscribersService } from '@novu/testing'; | ||
import { SubscriberEntity } from '@novu/dal'; | ||
import { echoServer } from '../../../../e2e/echo.server'; | ||
|
||
describe('Echo Health Check', async () => { | ||
let session: UserSession; | ||
let subscriber: SubscriberEntity; | ||
let subscriberService: SubscribersService; | ||
|
||
before(async () => { | ||
await echoServer.echo.workflow('health-check', async ({ step }) => { | ||
await step.email('send-email', async (inputs) => { | ||
return { | ||
subject: 'This is an email subject', | ||
body: 'Body result', | ||
}; | ||
}); | ||
}); | ||
}); | ||
|
||
beforeEach(async () => { | ||
session = new UserSession(); | ||
await session.initialize(); | ||
subscriberService = new SubscribersService(session.organization._id, session.environment._id); | ||
subscriber = await subscriberService.createSubscriber(); | ||
}); | ||
|
||
it('should have a status', async () => { | ||
const result = await axios.get(echoServer.serverPath + '/echo?action=health-check'); | ||
|
||
expect(result.data.status).to.equal('ok'); | ||
}); | ||
|
||
it('should have a version', async () => { | ||
const result = await axios.get(echoServer.serverPath + '/echo?action=health-check'); | ||
|
||
expect(result.data.version).to.be.a('string'); | ||
}); | ||
|
||
it('should return the discovered resources', async () => { | ||
const result = await axios.get(echoServer.serverPath + '/echo?action=health-check'); | ||
|
||
expect(result.data.discovered).to.deep.equal({ workflows: 1, steps: 1 }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { VERSION } from './version'; | ||
|
||
describe('version', () => { | ||
test('should export the current version', () => { | ||
const importVersion = VERSION; | ||
const packageJsonVersion = require('../package.json').version; | ||
expect(importVersion).toEqual(packageJsonVersion); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
// import packageJson from '../package.json' | ||
import packageJson from '../package.json'; | ||
|
||
/** | ||
* @TODO: Replace with the package version | ||
* Need to figure out how to get the package version in the SDK | ||
* export const VERSION = packageJson.version | ||
*/ | ||
export const VERSION = '0.0.1'; | ||
export const VERSION = packageJson.version; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters