Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Last active December 17, 2024 04:19
Show Gist options
  • Save YonatanKra/1bca1dc1597aaf358c6d84d2102f12d1 to your computer and use it in GitHub Desktop.
Save YonatanKra/1bca1dc1597aaf358c6d84d2102f12d1 to your computer and use it in GitHub Desktop.
describe('AltTextBot', () => {
const postUri = 'postUri';
let bot: AltTextBot;
beforeEach(async () => {
resetAtpAgentMock();
bot = new AltTextBot();
});
it('should initialize a new instance', async () => {
expect(bot).toBeDefined();
});
describe('checkSinglePost()', () => {
it('should return the error message if fetch post failed', async () => {
const error = { message: 'error' };
mockAtpAgent.getPost.mockRejectedValue(error);
const result = await bot.checkSinglePost(postUri);
expect(result).toEqual(error);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment